@@ -201,6 +201,7 @@ mod imp_prelude {
201
201
DataMut ,
202
202
DataOwned ,
203
203
DataShared ,
204
+ RawViewRepr ,
204
205
ViewRepr ,
205
206
Ix , Ixs ,
206
207
} ;
@@ -1119,6 +1120,57 @@ pub type ArrayView<'a, A, D> = ArrayBase<ViewRepr<&'a A>, D>;
1119
1120
/// [ab]: struct.ArrayBase.html
1120
1121
pub type ArrayViewMut < ' a , A , D > = ArrayBase < ViewRepr < & ' a mut A > , D > ;
1121
1122
1123
+ /// A read-only array view without a lifetime.
1124
+ ///
1125
+ /// This is similar to [`ArrayView`] but does not carry any lifetime or
1126
+ /// ownership information, and its data cannot be read without an unsafe
1127
+ /// conversion into an [`ArrayView`]. The relationship between `RawArrayView`
1128
+ /// and [`ArrayView`] is somewhat analogous to the relationship between `*const
1129
+ /// T` and `&T`, but `RawArrayView` has additional requirements that `*const T`
1130
+ /// does not, such as alignment and non-nullness.
1131
+ ///
1132
+ /// [`ArrayView`]: type.ArrayView.html
1133
+ ///
1134
+ /// The `RawArrayView<A, D>` is parameterized by `A` for the element type and
1135
+ /// `D` for the dimensionality.
1136
+ ///
1137
+ /// Raw array views have all the methods of an array (see
1138
+ /// [`ArrayBase`](struct.ArrayBase.html)).
1139
+ ///
1140
+ /// See also [`RawArrayViewMut`](type.RawArrayViewMut.html).
1141
+ ///
1142
+ /// # Warning
1143
+ ///
1144
+ /// You can't use this type wih an arbitrary raw pointer; see
1145
+ /// [`from_shape_ptr`](#method.from_shape_ptr) for details.
1146
+ pub type RawArrayView < A , D > = ArrayBase < RawViewRepr < * const A > , D > ;
1147
+
1148
+ /// A mutable array view without a lifetime.
1149
+ ///
1150
+ /// This is similar to [`ArrayViewMut`] but does not carry any lifetime or
1151
+ /// ownership information, and its data cannot be read/written without an
1152
+ /// unsafe conversion into an [`ArrayViewMut`]. The relationship between
1153
+ /// `RawArrayViewMut` and [`ArrayViewMut`] is somewhat analogous to the
1154
+ /// relationship between `*mut T` and `&mut T`, but `RawArrayViewMut` has
1155
+ /// additional requirements that `*mut T` does not, such as alignment and
1156
+ /// non-nullness.
1157
+ ///
1158
+ /// [`ArrayViewMut`]: type.ArrayViewMut.html
1159
+ ///
1160
+ /// The `RawArrayViewMut<A, D>` is parameterized by `A` for the element type
1161
+ /// and `D` for the dimensionality.
1162
+ ///
1163
+ /// Raw array views have all the methods of an array (see
1164
+ /// [`ArrayBase`](struct.ArrayBase.html)).
1165
+ ///
1166
+ /// See also [`RawArrayView`](type.RawArrayView.html).
1167
+ ///
1168
+ /// # Warning
1169
+ ///
1170
+ /// You can't use this type wih an arbitrary raw pointer; see
1171
+ /// [`from_shape_ptr`](#method.from_shape_ptr) for details.
1172
+ pub type RawArrayViewMut < A , D > = ArrayBase < RawViewRepr < * mut A > , D > ;
1173
+
1122
1174
/// Array's representation.
1123
1175
///
1124
1176
/// *Don’t use this type directly—use the type alias
@@ -1146,6 +1198,23 @@ impl<A> Clone for OwnedArcRepr<A> {
1146
1198
}
1147
1199
}
1148
1200
1201
+ /// Array pointer’s representation.
1202
+ ///
1203
+ /// *Don’t use this type directly—use the type aliases
1204
+ /// [`RawArrayView`](type.RawArrayView.html) /
1205
+ /// [`RawArrayViewMut`](type.RawArrayViewMut.html) for the array type!*
1206
+ #[ derive( Copy , Clone ) ]
1207
+ // This is just a marker type, to carry the mutability and element type.
1208
+ pub struct RawViewRepr < A > {
1209
+ ptr : PhantomData < A > ,
1210
+ }
1211
+
1212
+ impl < A > RawViewRepr < A > {
1213
+ #[ inline( always) ]
1214
+ fn new ( ) -> Self {
1215
+ RawViewRepr { ptr : PhantomData }
1216
+ }
1217
+ }
1149
1218
1150
1219
/// Array view’s representation.
1151
1220
///
0 commit comments