Struct containers::collections::Vec[][src]

pub struct Vec<T, A: Alloc = NullAllocator> { /* fields omitted */ }
Expand description

Growable array

Implementations

Make a new array.

Make a new array with enough room to hold at least cap elements.

Failures

Returns None if allocation fails.

Return number of elements array can hold before reallocation.

Make sure the array has enough room for at least n_more more elements, reallocating if need be.

Failures

Returns false if allocation fails, true otherwise.

Relinquish memory so capacity = length.

Insert element x at position k, shifting elements after k aftward one position to make room.

Failures

Returns Err(x) if allocation fails.

Panics

Panics if k is out of bounds.

Delete element at position k and return it, shifting elements after k forward one position to fill the gap.

Panics

Panics if k is out of bounds.

Delete element at position k and move the last element into the gap.

Panics

Panics if k is out of bounds.

Push x onto aft end of array.

Failures

Returns Err(x) if allocation fails.

Pop last element off end of array. Return None if array empty.

Append xs to the array.

Failures

Returns Err(xs) if allocation fails, in which case both self and xs are unmodified.

Copy xs and append it to the array.

Failures

Returns false if allocation fails, in which case self is unmodified.

Add elements of xs to aft end of array.

Failures

Returns Err of remainder of xs if allocation fails.

Add elements of xs to aft end of array.

Failures

Returns Err of remainder of xs if allocation fails, in which case some elements may have been added to xs already.

Make of a slice.

Failures

Returns None if allocation fails.

Shorten array to len and drop elements beyond.

Make a new array.

Make a new array with enough room to hold at least cap elements.

Failures

Returns None if allocation fails.

Add elements of xs to aft end of array.

Failures

Returns Err of remainder of xs if allocation fails, in which case some elements may have been added to xs already.

Make of a slice.

Failures

Returns None if allocation fails.

Split off and return the segment of the array from k to the aft end, inclusive.

Failures

Returns None if allocation fails, in which case self is unmodified.

Panics

Panics if k is out of bounds.

Trait Implementations

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Executes the destructor for this type. Read more

Performs the conversion.

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. 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

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

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

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Returns a pointer meeting the size and alignment guarantees of layout. Read more

Deallocate the memory referenced by ptr. Read more

Returns a pointer suitable for holding data described by new_layout, meeting its size and alignment guarantees. To accomplish this, this may extend or shrink the allocation referenced by ptr to fit new_layout. Read more

Behaves like alloc, but also ensures that the contents are set to zero before being returned. Read more

Behaves like alloc, but also returns the whole size of the returned block. For some layout inputs, like arrays, this may include extra storage usable for additional data. Read more

Behaves like realloc, but also returns the whole size of the returned block. For some layout inputs, like arrays, this may include extra storage usable for additional data. Read more

Attempts to resize the allocation referenced by ptr to fit new_layout. Read more

Returns bounds on the guaranteed usable size of a successful allocation created with the specified layout. Read more

Allocates a block suitable for holding an instance of T. Read more

Deallocates a block suitable for holding an instance of T. Read more

Allocates a block suitable for holding n instances of T. Read more

Reallocates a block previously suitable for holding n_old instances of T, returning a block suitable for holding n_new instances of T. Read more

Deallocates a block suitable for holding n instances of T. Read more

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.