[−][src]Struct c_vec::CSlice
The type representing an 'unsafe' foreign chunk of memory
Methods
impl<T> CSlice<T>
[src]
pub unsafe fn new(base: *mut T, len: usize) -> CSlice<T>
[src]
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
pub fn get<'a>(&'a self, ofs: usize) -> Option<&'a T>
[src]
Retrieves an element at a given index, returning None
if the requested
index is greater than the length of the vector.
pub fn get_mut<'a>(&'a mut self, ofs: usize) -> Option<&'a mut T>
[src]
Retrieves a mutable element at a given index, returning None
if the
requested index is greater than the length of the vector.
pub fn len(&self) -> usize
[src]
Returns the number of items in this vector.
pub fn is_empty(&self) -> bool
[src]
Returns whether this vector is empty.
pub fn iter<'a>(&'a self) -> CSliceIter<'a, T>
[src]
Returns an iterator over CVec.
Trait Implementations
impl<T> AsMut<[T]> for CSlice<T>
[src]
impl<T> AsRef<[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
[src]
impl<T> IndexMut<usize> for CSlice<T>
[src]
impl<T: Clone> Into<Vec<T>> for CSlice<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for CSlice<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> !Send for CSlice<T>
impl<T> !Sync for CSlice<T>
impl<T> Unpin for CSlice<T>
impl<T> UnwindSafe for CSlice<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,