Skip to content

Commit 218bb88

Browse files
committed
Rename DataRaw* traits to RawData*
1 parent c81ccdd commit 218bb88

File tree

7 files changed

+46
-46
lines changed

7 files changed

+46
-46
lines changed

src/data_traits.rs

+29-29
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ use {
2727
/// does not imply any ownership or lifetime; pointers to elements in the array
2828
/// may not be safe to dereference.
2929
///
30-
/// ***Note:*** `DataRaw` is not an extension interface at this point.
30+
/// ***Note:*** `RawData` is not an extension interface at this point.
3131
/// Traits in Rust can serve many different roles. This trait is public because
3232
/// it is used as a bound on public methods.
33-
pub unsafe trait DataRaw : Sized {
33+
pub unsafe trait RawData : Sized {
3434
/// The array element type.
3535
type Elem;
3636

@@ -45,8 +45,8 @@ pub unsafe trait DataRaw : Sized {
4545
///
4646
/// For an array with writable elements.
4747
///
48-
/// ***Internal trait, see `DataRaw`.***
49-
pub unsafe trait DataRawMut : DataRaw {
48+
/// ***Internal trait, see `RawData`.***
49+
pub unsafe trait RawDataMut : RawData {
5050
/// If possible, ensures that the array has unique access to its data.
5151
///
5252
/// If `Self` provides safe mutable access to array elements, then it
@@ -68,8 +68,8 @@ pub unsafe trait DataRawMut : DataRaw {
6868
///
6969
/// An array representation that can be cloned.
7070
///
71-
/// ***Internal trait, see `DataRaw`.***
72-
pub unsafe trait DataRawClone : DataRaw {
71+
/// ***Internal trait, see `RawData`.***
72+
pub unsafe trait RawDataClone : RawData {
7373
#[doc(hidden)]
7474
/// Unsafe because, `ptr` must point inside the current storage.
7575
unsafe fn clone_with_ptr(&self, ptr: *mut Self::Elem) -> (Self, *mut Self::Elem);
@@ -86,8 +86,8 @@ pub unsafe trait DataRawClone : DataRaw {
8686
///
8787
/// For an array with elements that can be accessed with safe code.
8888
///
89-
/// ***Internal trait, see `DataRaw`.***
90-
pub unsafe trait Data : DataRaw {
89+
/// ***Internal trait, see `RawData`.***
90+
pub unsafe trait Data : RawData {
9191
/// Converts the array to a uniquely owned array, cloning elements if necessary.
9292
#[doc(hidden)]
9393
fn into_owned<D>(self_: ArrayBase<Self, D>) -> ArrayBase<OwnedRepr<Self::Elem>, D>
@@ -105,10 +105,10 @@ pub unsafe trait Data : DataRaw {
105105
// # For implementers
106106
//
107107
// If you implement the `DataMut` trait, you are guaranteeing that the
108-
// `DataRawMut::try_ensure_unique` implementation always panics or ensures that
108+
// `RawDataMut::try_ensure_unique` implementation always panics or ensures that
109109
// the data is unique. You are also guaranteeing that `try_is_unique` always
110110
// returns `Some(_)`.
111-
pub unsafe trait DataMut : Data + DataRawMut {
111+
pub unsafe trait DataMut : Data + RawDataMut {
112112
/// Ensures that the array has unique access to its data.
113113
#[doc(hidden)]
114114
#[inline]
@@ -133,35 +133,35 @@ pub unsafe trait DataMut : Data + DataRawMut {
133133
/// accessed with safe code.
134134
///
135135
/// ***Internal trait, see `Data`.***
136-
#[deprecated(note="use `Data + DataRawClone` instead", since="0.13")]
137-
pub trait DataClone : Data + DataRawClone {}
136+
#[deprecated(note="use `Data + RawDataClone` instead", since="0.13")]
137+
pub trait DataClone : Data + RawDataClone {}
138138

139139
#[allow(deprecated)]
140-
impl<T> DataClone for T where T: Data + DataRawClone {}
140+
impl<T> DataClone for T where T: Data + RawDataClone {}
141141

142-
unsafe impl<A> DataRaw for RawViewRepr<*const A> {
142+
unsafe impl<A> RawData for RawViewRepr<*const A> {
143143
type Elem = A;
144144
fn _data_slice(&self) -> Option<&[A]> {
145145
None
146146
}
147147
private_impl!{}
148148
}
149149

150-
unsafe impl<A> DataRawClone for RawViewRepr<*const A> {
150+
unsafe impl<A> RawDataClone for RawViewRepr<*const A> {
151151
unsafe fn clone_with_ptr(&self, ptr: *mut Self::Elem) -> (Self, *mut Self::Elem) {
152152
(*self, ptr)
153153
}
154154
}
155155

156-
unsafe impl<A> DataRaw for RawViewRepr<*mut A> {
156+
unsafe impl<A> RawData for RawViewRepr<*mut A> {
157157
type Elem = A;
158158
fn _data_slice(&self) -> Option<&[A]> {
159159
None
160160
}
161161
private_impl!{}
162162
}
163163

164-
unsafe impl<A> DataRawMut for RawViewRepr<*mut A> {
164+
unsafe impl<A> RawDataMut for RawViewRepr<*mut A> {
165165
#[inline]
166166
fn try_ensure_unique<D>(_: &mut ArrayBase<Self, D>)
167167
where Self: Sized,
@@ -174,13 +174,13 @@ unsafe impl<A> DataRawMut for RawViewRepr<*mut A> {
174174
}
175175
}
176176

177-
unsafe impl<A> DataRawClone for RawViewRepr<*mut A> {
177+
unsafe impl<A> RawDataClone for RawViewRepr<*mut A> {
178178
unsafe fn clone_with_ptr(&self, ptr: *mut Self::Elem) -> (Self, *mut Self::Elem) {
179179
(*self, ptr)
180180
}
181181
}
182182

183-
unsafe impl<A> DataRaw for OwnedArcRepr<A> {
183+
unsafe impl<A> RawData for OwnedArcRepr<A> {
184184
type Elem = A;
185185
fn _data_slice(&self) -> Option<&[A]> {
186186
Some(&self.0)
@@ -189,7 +189,7 @@ unsafe impl<A> DataRaw for OwnedArcRepr<A> {
189189
}
190190

191191
// NOTE: Copy on write
192-
unsafe impl<A> DataRawMut for OwnedArcRepr<A>
192+
unsafe impl<A> RawDataMut for OwnedArcRepr<A>
193193
where
194194
A: Clone,
195195
{
@@ -246,22 +246,22 @@ unsafe impl<A> Data for OwnedArcRepr<A> {
246246

247247
unsafe impl<A> DataMut for OwnedArcRepr<A> where A: Clone {}
248248

249-
unsafe impl<A> DataRawClone for OwnedArcRepr<A> {
249+
unsafe impl<A> RawDataClone for OwnedArcRepr<A> {
250250
unsafe fn clone_with_ptr(&self, ptr: *mut Self::Elem) -> (Self, *mut Self::Elem) {
251251
// pointer is preserved
252252
(self.clone(), ptr)
253253
}
254254
}
255255

256-
unsafe impl<A> DataRaw for OwnedRepr<A> {
256+
unsafe impl<A> RawData for OwnedRepr<A> {
257257
type Elem = A;
258258
fn _data_slice(&self) -> Option<&[A]> {
259259
Some(&self.0)
260260
}
261261
private_impl!{}
262262
}
263263

264-
unsafe impl<A> DataRawMut for OwnedRepr<A> {
264+
unsafe impl<A> RawDataMut for OwnedRepr<A> {
265265
#[inline]
266266
fn try_ensure_unique<D>(_: &mut ArrayBase<Self, D>)
267267
where Self: Sized,
@@ -287,7 +287,7 @@ unsafe impl<A> Data for OwnedRepr<A> {
287287

288288
unsafe impl<A> DataMut for OwnedRepr<A> { }
289289

290-
unsafe impl<A> DataRawClone for OwnedRepr<A>
290+
unsafe impl<A> RawDataClone for OwnedRepr<A>
291291
where A: Clone
292292
{
293293
unsafe fn clone_with_ptr(&self, ptr: *mut Self::Elem) -> (Self, *mut Self::Elem) {
@@ -313,7 +313,7 @@ unsafe impl<A> DataRawClone for OwnedRepr<A>
313313
}
314314
}
315315

316-
unsafe impl<'a, A> DataRaw for ViewRepr<&'a A> {
316+
unsafe impl<'a, A> RawData for ViewRepr<&'a A> {
317317
type Elem = A;
318318
fn _data_slice(&self) -> Option<&[A]> {
319319
None
@@ -331,21 +331,21 @@ unsafe impl<'a, A> Data for ViewRepr<&'a A> {
331331
}
332332
}
333333

334-
unsafe impl<'a, A> DataRawClone for ViewRepr<&'a A> {
334+
unsafe impl<'a, A> RawDataClone for ViewRepr<&'a A> {
335335
unsafe fn clone_with_ptr(&self, ptr: *mut Self::Elem) -> (Self, *mut Self::Elem) {
336336
(*self, ptr)
337337
}
338338
}
339339

340-
unsafe impl<'a, A> DataRaw for ViewRepr<&'a mut A> {
340+
unsafe impl<'a, A> RawData for ViewRepr<&'a mut A> {
341341
type Elem = A;
342342
fn _data_slice(&self) -> Option<&[A]> {
343343
None
344344
}
345345
private_impl!{}
346346
}
347347

348-
unsafe impl<'a, A> DataRawMut for ViewRepr<&'a mut A> {
348+
unsafe impl<'a, A> RawDataMut for ViewRepr<&'a mut A> {
349349
#[inline]
350350
fn try_ensure_unique<D>(_: &mut ArrayBase<Self, D>)
351351
where Self: Sized,
@@ -389,7 +389,7 @@ pub unsafe trait DataOwned : Data {
389389
/// A representation that is a lightweight view.
390390
///
391391
/// ***Internal trait, see `Data`.***
392-
pub unsafe trait DataShared : Clone + Data + DataRawClone { }
392+
pub unsafe trait DataShared : Clone + Data + RawDataClone { }
393393

394394
unsafe impl<A> DataShared for OwnedRcRepr<A> {}
395395
unsafe impl<'a, A> DataShared for ViewRepr<&'a A> {}

src/impl_1d.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use imp_prelude::*;
1212

1313
/// # Methods For 1-D Arrays
1414
impl<A, S> ArrayBase<S, Ix1>
15-
where S: DataRaw<Elem=A>,
15+
where S: RawData<Elem=A>,
1616
{
1717
/// Return an vector with the elements of the one-dimensional array.
1818
pub fn to_vec(&self) -> Vec<A>

src/impl_2d.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use imp_prelude::*;
1212

1313
/// # Methods For 2-D Arrays
1414
impl<A, S> ArrayBase<S, Ix2>
15-
where S: DataRaw<Elem=A>,
15+
where S: RawData<Elem=A>,
1616
{
1717
/// Return an array view of row `index`.
1818
///

src/impl_clone.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
// option. This file may not be copied, modified, or distributed
77
// except according to those terms.
88
use imp_prelude::*;
9-
use DataRawClone;
9+
use RawDataClone;
1010

11-
impl<S: DataRawClone, D: Clone> Clone for ArrayBase<S, D> {
11+
impl<S: RawDataClone, D: Clone> Clone for ArrayBase<S, D> {
1212
fn clone(&self) -> ArrayBase<S, D> {
1313
unsafe {
1414
let (data, ptr) = self.data.clone_with_ptr(self.ptr);
@@ -33,4 +33,4 @@ impl<S: DataRawClone, D: Clone> Clone for ArrayBase<S, D> {
3333
}
3434
}
3535

36-
impl<S: DataRawClone + Copy, D: Copy> Copy for ArrayBase<S, D> {}
36+
impl<S: RawDataClone + Copy, D: Copy> Copy for ArrayBase<S, D> {}

src/impl_methods.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use stacking::stack;
4747
/// # Methods For All Array Types
4848
impl<A, S, D> ArrayBase<S, D>
4949
where
50-
S: DataRaw<Elem = A>,
50+
S: RawData<Elem = A>,
5151
D: Dimension,
5252
{
5353
/// Return the total number of elements in the array.
@@ -503,7 +503,7 @@ where
503503
}
504504

505505
pub(crate) fn get_ptr_mut<I>(&mut self, index: I) -> Option<*mut A>
506-
where S: DataRawMut,
506+
where S: RawDataMut,
507507
I: NdIndex<D>,
508508
{
509509
// const and mut are separate to enforce &mutness as well as the
@@ -1143,7 +1143,7 @@ where
11431143
///
11441144
/// This method is mostly only useful with unsafe code.
11451145
fn try_ensure_unique(&mut self)
1146-
where S: DataRawMut
1146+
where S: RawDataMut
11471147
{
11481148
debug_assert!(self.pointer_is_inbounds());
11491149
S::try_ensure_unique(self);
@@ -1204,7 +1204,7 @@ where
12041204
/// Return a mutable pointer to the first element in the array.
12051205
#[inline(always)]
12061206
pub fn as_mut_ptr(&mut self) -> *mut A
1207-
where S: DataRawMut
1207+
where S: RawDataMut
12081208
{
12091209
self.try_ensure_unique(); // for RcArray
12101210
self.ptr
@@ -1219,7 +1219,7 @@ where
12191219
/// Return a raw mutable view of the array.
12201220
#[inline]
12211221
pub fn raw_view_mut(&mut self) -> RawArrayViewMut<A, D>
1222-
where S: DataRawMut
1222+
where S: RawDataMut
12231223
{
12241224
self.try_ensure_unique(); // for RcArray
12251225
unsafe { RawArrayViewMut::new_(self.ptr, self.dim.clone(), self.strides.clone()) }

src/impl_raw_views.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ where
8989
self.ptr
9090
} else {
9191
let offset = stride_offset(index, self.strides.axis(axis));
92-
// The `.offset()` is safe due to the guarantees of `DataRaw`.
92+
// The `.offset()` is safe due to the guarantees of `RawData`.
9393
unsafe { self.ptr.offset(offset) }
9494
};
9595

src/lib.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ pub use aliases::*;
153153

154154
#[allow(deprecated)]
155155
pub use data_traits::{
156-
DataRaw,
157-
DataRawMut,
158-
DataRawClone,
156+
RawData,
157+
RawDataMut,
158+
RawDataClone,
159159
Data,
160160
DataMut,
161161
DataOwned,
@@ -197,8 +197,8 @@ mod imp_prelude {
197197
pub use ArcArray;
198198
pub use {
199199
RemoveAxis,
200-
DataRaw,
201-
DataRawMut,
200+
RawData,
201+
RawDataMut,
202202
Data,
203203
DataMut,
204204
DataOwned,
@@ -1031,7 +1031,7 @@ pub type Ixs = isize;
10311031
//
10321032
// [`.offset()`]: https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.offset-1
10331033
pub struct ArrayBase<S, D>
1034-
where S: DataRaw
1034+
where S: RawData
10351035
{
10361036
/// Data buffer / ownership information. (If owned, contains the data
10371037
/// buffer; if borrowed, contains the lifetime and mutability.)

0 commit comments

Comments
 (0)