#[repr(C)]pub struct CMutSlice<'a, T> { /* private fields */ }
Expand description
A mutable slice, equivalent to &'a mut T
.
A CMutSlice
can be constructed from a corresponding Rust slice via the AsCMutSlice
trait.
A Rust slice can be constructed from a corresponding CMutSlice
via as_mut
.
Implementations§
Source§impl<'a, T> CMutSlice<'a, T>
impl<'a, T> CMutSlice<'a, T>
Sourcepub unsafe fn new(base: *mut T, len: usize) -> Self
pub unsafe fn new(base: *mut T, len: usize) -> Self
Create a CSlice
from raw data.
§Safety
The region of memory from base
(inclusive) to base + len * sizeof<T>
(exclusive) must be valid for the duration of lifetime 'a
.
Sourcepub fn as_mut_ptr(&mut self) -> *mut T
pub fn as_mut_ptr(&mut self) -> *mut T
Produces a raw pointer to the slice’s buffer.
Sourcepub fn as_slice(&self) -> &'a [T]
pub fn as_slice(&self) -> &'a [T]
A cheap conversion to a Rust slice. This is slightly more general than as_ref
.
Sourcepub fn as_mut_slice(&mut self) -> &'a mut [T]
pub fn as_mut_slice(&mut self) -> &'a mut [T]
A cheap conversion to a mutable Rust slice. This is slightly more general than as_mut
.
Trait Implementations§
impl<'a, T: Copy> Copy for CMutSlice<'a, T>
impl<'a, T: Send> Send for CMutSlice<'a, T>
impl<'a, T: Sync> Sync for CMutSlice<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for CMutSlice<'a, T>
impl<'a, T> RefUnwindSafe for CMutSlice<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Unpin for CMutSlice<'a, T>
impl<'a, T> UnwindSafe for CMutSlice<'a, T>where
T: 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