pub struct A<'a, X> {
pub ptr: NonNull<X>,
pub L: u32,
pub own: bool,
pub Rev: bool,
/* private fields */
}Expand description
a static length, copy-on-write vector type with element type X
Fields§
§ptr: NonNull<X>ptr to the buffer of elements
L: u32vector length
own: booldo we own this buffer?
Rev: boolis this buffer reversed?
Implementations§
Source§impl<'a, X> A<'a, X>
impl<'a, X> A<'a, X>
Sourcepub fn empty(len: usize) -> A<'a, X>
pub fn empty(len: usize) -> A<'a, X>
allocate an empty buffer of X. not really useful by itself.
Sourcepub fn from_ptr(ptr: NonNull<X>, L: u32, Rev: bool) -> A<'a, X>
pub fn from_ptr(ptr: NonNull<X>, L: u32, Rev: bool) -> A<'a, X>
make a non-owned A from a ptr with length L
Sourcepub unsafe fn ptr_add_NN(&self, i: usize) -> NonNull<X>
pub unsafe fn ptr_add_NN(&self, i: usize) -> NonNull<X>
add i to the buffer ptr and make it NonNull
pub fn len(&self) -> usize
pub fn mkref<'b>(&'b self) -> A<'a, X>where
'b: 'a,
Sourcepub unsafe fn set_nocpy(&mut self, i: usize, x: X)
pub unsafe fn set_nocpy(&mut self, i: usize, x: X)
set a value in the buffer. THIS WRevITE DOES NOT COPY.
this function is only safe to use if you know that the buffer is
owned (ie you just allocated it with empty). otherwise, the change
will be propagated to all As that have ever been derived from
this same buffer.
Sourcepub unsafe fn at_nochk(&self, i: usize) -> X
pub unsafe fn at_nochk(&self, i: usize) -> X
get a value from the buffer without checking the boundary.
Trait Implementations§
Auto Trait Implementations§
impl<'a, X> !Send for A<'a, X>
impl<'a, X> !Sync for A<'a, X>
impl<'a, X> Freeze for A<'a, X>
impl<'a, X> RefUnwindSafe for A<'a, X>where
X: RefUnwindSafe,
impl<'a, X> Unpin for A<'a, X>
impl<'a, X> UnsafeUnpin for A<'a, X>
impl<'a, X> UnwindSafe for A<'a, X>where
X: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more