Struct cslice::CMutSlice
[−]
[src]
#[repr(C)]pub struct CMutSlice<'a, T> { /* fields omitted */ }
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
.
Methods
impl<'a, T> CMutSlice<'a, T>
[src]
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
.
fn as_ptr(&self) -> *const T
Produces a raw pointer to the slice's buffer.
fn as_mut_ptr(&mut self) -> *mut T
Produces a raw pointer to the slice's buffer.
fn as_slice(&self) -> &'a [T]
A cheap conversion to a Rust slice. This is slightly more general than as_ref
.
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
.
fn len(&self) -> usize
Returns the number of elements in the slice.
Trait Implementations
impl<'a, T: Clone> Clone for CMutSlice<'a, T>
[src]
fn clone(&self) -> CMutSlice<'a, T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<'a, T: Copy> Copy for CMutSlice<'a, T>
[src]
impl<'a, T> AsRef<[T]> for CMutSlice<'a, T>
[src]
impl<'a, T> AsMut<[T]> for CMutSlice<'a, T>
[src]
impl<'a, T: Sync> Sync for CMutSlice<'a, T>
[src]
impl<'a, T: Send> Send for CMutSlice<'a, T>
[src]
impl<'a, T> Index<usize> for CMutSlice<'a, T>
[src]
type Output = T
The returned type after indexing
fn index(&self, i: usize) -> &T
The method for the indexing (container[index]
) operation