Struct c_vec::CSlice
[−]
[src]
pub struct CSlice<T> { /* fields omitted */ }
The type representing an 'unsafe' foreign chunk of memory
Methods
impl<T> CSlice<T>
[src]
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.
Trait Implementations
impl<T> AsRef<[T]> for CSlice<T>
[src]
impl<T> AsMut<[T]> for CSlice<T>
[src]
impl<T> Index<usize> for CSlice<T>
[src]
type Output = T
The returned type after indexing
fn index<'a>(&'a self, _index: usize) -> &'a T
The method for the indexing (container[index]
) operation
impl<T> IndexMut<usize> for CSlice<T>
[src]
fn index_mut<'a>(&'a mut self, _index: usize) -> &'a mut T
The method for the mutable indexing (container[index]
) operation