Struct cslice::CSlice
[−]
[src]
pub struct CSlice<'a, T> { // some 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
.
Methods
impl<'a, T> CSlice<'a, T>
[src]
unsafe fn new(base: *const 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 len(&self) -> usize
Returns the number of elements in the slice.
Trait Implementations
impl<'a, T: Copy> Copy for CSlice<'a, T>
[src]
impl<'a, T: Clone> Clone for CSlice<'a, T>
[src]
fn clone(&self) -> CSlice<'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