[][src]Struct cslice::CSlice

#[repr(C)]pub struct CSlice<'a, T> { /* fields omitted */ }

An immutable slice, equivalent to &'a T.

A CSlice can be constructed from a corresponding Rust slice via the AsCSlice trait.

A Rust slice can be constructed from a corresponding CSlice via as_ref.

Implementations

impl<'a, T> CSlice<'a, T>[src]

pub unsafe fn new(base: *const T, len: usize) -> Self[src]

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.

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

Produces a raw pointer to the slice's buffer.

pub fn len(&self) -> usize[src]

Returns the number of elements in the slice.

Trait Implementations

impl<'a, T> AsRef<[T]> for CSlice<'a, T>[src]

impl<'a, T: Clone> Clone for CSlice<'a, T>[src]

impl<'a, T: Copy> Copy for CSlice<'a, T>[src]

impl<'a, T> Index<usize> for CSlice<'a, T>[src]

type Output = T

The returned type after indexing.

impl<'a, T: Sync> Send for CSlice<'a, T>[src]

impl<'a, T: Sync> Sync for CSlice<'a, T>[src]

Auto Trait Implementations

impl<'a, T> RefUnwindSafe for CSlice<'a, T> where
    T: RefUnwindSafe

impl<'a, T> Unpin for CSlice<'a, T>

impl<'a, T> UnwindSafe for CSlice<'a, T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.