Struct cxx::CxxVector[][src]

#[repr(C, packed)]
pub struct CxxVector<T> { /* fields omitted */ }
Expand description

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

Returns the number of elements in the vector.

Matches the behavior of C++ std::vector<T>::size.

Returns true if the vector contains no elements.

Matches the behavior of C++ std::vector<T>::empty.

Returns a reference to an element at the given position, or None if out of bounds.

Returns a pinned mutable reference to an element at the given position, or None if out of bounds.

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[] const.

Returns a pinned mutable 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[].

Returns a slice to the underlying contiguous array of elements.

Returns a slice to the underlying contiguous array of elements by mutable reference.

Returns an iterator over elements of type &T.

Returns an iterator over elements of type Pin<&mut T>.

Appends an element to the back of the vector.

Matches the behavior of C++ std::vector<T>::push_back.

Removes the last element from a vector and returns it, or None if the vector is empty.

Trait Implementations

Formats the value using the given formatter. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.