Struct CMutSlice

Source
#[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>

Source

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.

Source

pub fn as_ptr(&self) -> *const T

Produces a raw pointer to the slice’s buffer.

Source

pub fn as_mut_ptr(&mut self) -> *mut T

Produces a raw pointer to the slice’s buffer.

Source

pub fn as_slice(&self) -> &'a [T]

A cheap conversion to a Rust slice. This is slightly more general than as_ref.

Source

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.

Source

pub fn len(&self) -> usize

Returns the number of elements in the slice.

Trait Implementations§

Source§

impl<'a, T> AsMut<[T]> for CMutSlice<'a, T>

Source§

fn as_mut(&mut self) -> &mut [T]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<'a, T> AsRef<[T]> for CMutSlice<'a, T>

Source§

fn as_ref(&self) -> &[T]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'a, T: Clone> Clone for CMutSlice<'a, T>

Source§

fn clone(&self) -> CMutSlice<'a, T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, T> Index<usize> for CMutSlice<'a, T>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, i: usize) -> &T

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a, T> IndexMut<usize> for CMutSlice<'a, T>

Source§

fn index_mut(&mut self, i: usize) -> &mut T

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<'a, T: Copy> Copy for CMutSlice<'a, T>

Source§

impl<'a, T: Send> Send for CMutSlice<'a, T>

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.