@@ -597,8 +597,11 @@ impl<A, S, D> ArrayBase<S, D> where S: Data<Elem=A>, D: Dimension
597
597
self . ptr
598
598
}
599
599
600
- /// Return the array’s data as a slice, if it is contiguous and
601
- /// the element order corresponds to the memory order. Return `None` otherwise.
600
+ /// Return the array’s data as a slice, if it is contiguous and in standard order.
601
+ /// Return `None` otherwise.
602
+ ///
603
+ /// If this function returns `Some(_)`, then the element order in the slice
604
+ /// corresponds to the logical order of the array’s elements.
602
605
pub fn as_slice ( & self ) -> Option < & [ A ] > {
603
606
if self . is_standard_layout ( ) {
604
607
unsafe {
@@ -609,8 +612,8 @@ impl<A, S, D> ArrayBase<S, D> where S: Data<Elem=A>, D: Dimension
609
612
}
610
613
}
611
614
612
- /// Return the array’s data as a slice, if it is contiguous and
613
- /// the element order corresponds to the memory order. Return `None` otherwise.
615
+ /// Return the array’s data as a slice, if it is contiguous and in standard order.
616
+ /// Return `None` otherwise.
614
617
pub fn as_slice_mut ( & mut self ) -> Option < & mut [ A ] >
615
618
where S : DataMut
616
619
{
@@ -626,7 +629,12 @@ impl<A, S, D> ArrayBase<S, D> where S: Data<Elem=A>, D: Dimension
626
629
627
630
/// Return the array’s data as a slice if it is contiguous,
628
631
/// return `None` otherwise.
629
- pub fn as_slice_no_order ( & self ) -> Option < & [ A ] > {
632
+ ///
633
+ /// If this function returns `Some(_)`, then the elements in the slice
634
+ /// have whatever order the elements have in memory.
635
+ ///
636
+ /// Implementation notes: Does not yet support negatively strided arrays.
637
+ pub fn as_slice_memory_order ( & self ) -> Option < & [ A ] > {
630
638
if self . is_contiguous ( ) {
631
639
unsafe {
632
640
Some ( slice:: from_raw_parts ( self . ptr , self . len ( ) ) )
@@ -638,7 +646,7 @@ impl<A, S, D> ArrayBase<S, D> where S: Data<Elem=A>, D: Dimension
638
646
639
647
/// Return the array’s data as a slice if it is contiguous,
640
648
/// return `None` otherwise.
641
- pub fn as_slice_mut_no_order ( & mut self ) -> Option < & mut [ A ] >
649
+ pub fn as_slice_memory_order_mut ( & mut self ) -> Option < & mut [ A ] >
642
650
where S : DataMut
643
651
{
644
652
if self . is_contiguous ( ) {
0 commit comments