[−][src]Struct cxx::CxxVector
Binding to C++ std::vector<T, std::allocator<T>>
.
Invariants
As an invariant of this API and the static analysis of the cxx::bridge
macro, in Rust code we can never obtain a CxxVector
by value. Instead in
Rust code we will only ever look at a vector behind a reference or smart
pointer, as in &CxxVector<T>
or UniquePtr<CxxVector<T>>
.
Implementations
impl<T> CxxVector<T> where
T: VectorElement,
[src]
T: VectorElement,
pub fn len(&self) -> usize
[src]
Returns the number of elements in the vector.
Matches the behavior of C++ std::vector<T>::size.
pub fn is_empty(&self) -> bool
[src]
Returns true if the vector contains no elements.
Matches the behavior of C++ std::vector<T>::empty.
pub fn get(&self, pos: usize) -> Option<&T>
[src]
Returns a reference to an element at the given position, or None
if
out of bounds.
pub unsafe fn get_unchecked(&self, pos: usize) -> &T
[src]
Returns a reference to an element without doing bounds checking.
This is generally not recommended, use with caution! Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used.
Matches the behavior of C++ std::vector<T>::operator[].
pub fn as_slice(&self) -> &[T]
[src]
Returns a slice to the underlying contiguous array of elements.
pub fn iter(&self) -> Iter<'_, T>
[src]
Returns an iterator over elements of type &T
.
Trait Implementations
impl<'a, T> IntoIterator for &'a CxxVector<T> where
T: VectorElement,
[src]
T: VectorElement,
Auto Trait Implementations
impl<T> RefUnwindSafe for CxxVector<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for CxxVector<T> where
T: Send,
T: Send,
impl<T> Sync for CxxVector<T> where
T: Sync,
T: Sync,
impl<T> !Unpin for CxxVector<T>
impl<T> UnwindSafe for CxxVector<T> where
T: UnwindSafe,
T: UnwindSafe,
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,
pub 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.
pub 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>,