Skip to main content

TensorVec

Trait TensorVec 

Source
pub trait TensorVec
where Self: FromIterator<Self::Item> + Index<usize, Output = Self::Item> + IndexMut<usize>,
{ type Item; // Required methods fn append(&mut self, other: &mut Self); fn capacity(&self) -> usize; fn is_empty(&self) -> bool; fn new() -> Self; fn push(&mut self, item: Self::Item); fn remove(&mut self, index: usize) -> Self::Item; fn reserve(&mut self, additional: usize); fn retain<F>(&mut self, f: F) where F: FnMut(&Self::Item) -> bool; fn swap_remove(&mut self, index: usize) -> Self::Item; fn with_capacity(capacity: usize) -> Self; }
Expand description

Common methods for tensors derived from Vec.

Required Associated Types§

Source

type Item

The type of element encountered when iterating over the tensor.

Required Methods§

Source

fn append(&mut self, other: &mut Self)

Moves all the elements of other into self, leaving other empty.

Source

fn capacity(&self) -> usize

Returns the total number of elements the vector can hold without reallocating.

Source

fn is_empty(&self) -> bool

Returns true if the vector contains no elements.

Source

fn new() -> Self

Constructs a new, empty Vec, not allocating until elements are pushed onto it.

Source

fn push(&mut self, item: Self::Item)

Appends an element to the back of the Vec.

Source

fn remove(&mut self, index: usize) -> Self::Item

Removes an element from the Vec and returns it, shifting elements to the left.

Source

fn reserve(&mut self, additional: usize)

Reserves capacity for at least additional more elements to be inserted in the given Vec.

Source

fn retain<F>(&mut self, f: F)
where F: FnMut(&Self::Item) -> bool,

Retains only the elements specified by the predicate.

Source

fn swap_remove(&mut self, index: usize) -> Self::Item

Removes an element from the Vec and returns it, replacing it with the last element.

Source

fn with_capacity(capacity: usize) -> Self

Constructs a new, empty vector with at least the specified capacity.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§