Struct c_vec::CSlice
[−]
[src]
pub struct CSlice<T> { // some fields omitted }
The type representing an 'unsafe' foreign chunk of memory
Methods
impl<T> CSlice<T>
unsafe fn new(base: *mut T, len: usize) -> CSlice<T>
Create a CSlice
from a raw pointer to a buffer with a given length.
Panics if the given pointer is null. The returned vector will not attempt to deallocate the vector when dropped.
Arguments
- base - A raw pointer to a buffer
- len - The number of elements in the buffer
fn get<'a>(&'a self, ofs: usize) -> Option<&'a T>
Retrieves an element at a given index, returning None
if the requested
index is greater than the length of the vector.
fn get_mut<'a>(&'a mut self, ofs: usize) -> Option<&'a mut T>
Retrieves a mutable element at a given index, returning None
if the
requested index is greater than the length of the vector.
fn len(&self) -> usize
Returns the number of items in this vector.
fn is_empty(&self) -> bool
Returns whether this vector is empty.