|
|
constexpr | Vec () |
| | Creates an empty Vec with no allocation.
|
| |
| constexpr auto | as_slice () const noexcept -> slice< T > |
| | Returns a slice containing the entire vector.
|
| |
| constexpr auto | as_mut_slice () noexcept -> mut_ptr< T[]> |
| | Returns a mutable slice containing the entire vector.
|
| |
| constexpr auto | as_ptr () const noexcept -> ptr< T > |
| | Returns a const pointer to the first element of the vector.
|
| |
| auto | into_boxed_slice () noexcept -> Box< T[]> |
| | Converts this Vec into a Box<T[]>, transferring ownership of all elements.
|
| |
| constexpr void | push (T &&value) |
| | Appends an element to the back of the vector by moving it.
|
| |
| constexpr auto | pop () -> Option< T > |
| | Removes the last element from the vector and returns it, or None if empty.
|
| |
| constexpr void | push_back (const T &value) |
| | Appends a cloned copy of the element to the back of the vector.
|
| |
|
constexpr void | pop_back () |
| | Removes the last element from the vector, discarding it.
|
| |
| constexpr T & | at (usize index) |
| | Returns a mutable reference to the element at the given index, panicking if out of bounds.
|
| |
| constexpr const T & | at (usize index) const |
| | Returns a const reference to the element at the given index, panicking if out of bounds.
|
| |
|
constexpr T & | operator[] (usize index) |
| | Indexes into the vector, panicking if out of bounds.
|
| |
|
constexpr const T & | operator[] (usize index) const |
| | Indexes into the vector (const), panicking if out of bounds.
|
| |
| constexpr usize | len () const |
| | Returns the number of elements in the vector.
|
| |
| constexpr usize | capacity () const |
| | Returns the number of elements the vector can hold without reallocating.
|
| |
|
constexpr bool | is_empty () const |
| | Returns true if the vector contains no elements.
|
| |
|
constexpr void | clear () |
| | Clears the vector, destroying all elements but not deallocating memory.
|
| |
| constexpr T | remove (usize index) |
| | Removes and returns the element at the given index, shifting subsequent elements left.
|
| |
|
constexpr auto | begin () noexcept |
| | Returns a mutable iterator to the beginning.
|
| |
|
constexpr auto | end () noexcept |
| | Returns a mutable iterator to the end.
|
| |
|
constexpr auto | begin () const noexcept |
| | Returns a const iterator to the beginning.
|
| |
|
constexpr auto | end () const noexcept |
| | Returns a const iterator to the end.
|
| |
template<typename T>
class alloc::vec::Vec< T >
A contiguous growable array type, analogous to Rust's Vec<T>.
- Template Parameters
-
| T | The element type, which must be Sized. |