Struct ShortVec

Source
pub struct ShortVec<T: Inner>(/* private fields */);

Implementations§

Source§

impl<T: Inner> ShortVec<T>

Source

pub fn new() -> Self

Source

pub fn new_from_vec(vec: Vec<T>) -> Result<Self>

Source

pub fn new_from_vec_unchecked(vec: Vec<T>) -> Self

Source

pub unsafe fn new_from_vec_unsafe(vec: Vec<T>) -> Self

Source

pub fn inner(&self) -> &Vec<T>

Source

pub fn inner_mut(&mut self) -> &mut Vec<T>

Source

pub fn as_vec(&self) -> Vec<T>

Source

pub fn as_slice(&self) -> &[T]

Source

pub fn into_vec(self) -> Vec<T>

Source

pub fn push(&mut self, item: T)

Source

pub fn pop(&mut self) -> Option<T>

Source

pub fn remove(&mut self, index: usize) -> T

Source

pub fn len(&self) -> usize

Source§

impl<T: Inner + PartialEq> ShortVec<T>

Source

pub fn contains(&self, item: &T) -> bool

Trait Implementations§

Source§

impl<T: Inner> BorshDeserialize for ShortVec<T>

Source§

fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self>

Source§

fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>

Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes.
Source§

fn try_from_slice(v: &[u8]) -> Result<Self, Error>

Deserialize this instance from a slice of bytes.
Source§

fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>
where R: Read,

Source§

impl<T: Inner> BorshSerialize for ShortVec<T>

Source§

fn serialize<W: Write>(&self, writer: &mut W) -> Result<()>

Source§

fn try_to_vec(&self) -> Result<Vec<u8>, Error>

Serialize this instance into a vector of bytes.
Source§

impl<T: Clone + Inner> Clone for ShortVec<T>

Source§

fn clone(&self) -> ShortVec<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Inner> From<&Vec<T>> for ShortVec<T>

Source§

fn from(value: &Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Inner> From<Vec<T>> for ShortVec<T>

Source§

fn from(value: Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Inner> FromIterator<T> for ShortVec<T>

Source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<T: Inner> Index<usize> for ShortVec<T>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, i: usize) -> &T

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

impl<T: Inner> IndexMut<usize> for ShortVec<T>

Source§

fn index_mut(&mut self, i: usize) -> &mut T

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

impl<T: Inner> Into<Vec<T>> for ShortVec<T>

Source§

fn into(self) -> Vec<T>

Converts this type into the (usually inferred) input type.
Source§

impl<T: Inner> IntoIterator for ShortVec<T>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = ShortVecIter<T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T: Inner + PartialEq> PartialEq<Vec<T>> for ShortVec<T>

Source§

fn eq(&self, other: &Vec<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialEq + Inner> PartialEq for ShortVec<T>

Source§

fn eq(&self, other: &ShortVec<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Inner + ToNode> ToNode for ShortVec<T>

Source§

fn to_node(&self) -> [u8; 32]

Source§

impl<T: Inner + ToNode + ToSchema> ToSchema for ShortVec<T>

Source§

impl<T: Eq + Inner> Eq for ShortVec<T>

Source§

impl<T: Inner> StructuralPartialEq for ShortVec<T>

Auto Trait Implementations§

§

impl<T> Freeze for ShortVec<T>

§

impl<T> RefUnwindSafe for ShortVec<T>
where T: RefUnwindSafe,

§

impl<T> Send for ShortVec<T>
where T: Send,

§

impl<T> Sync for ShortVec<T>
where T: Sync,

§

impl<T> Unpin for ShortVec<T>
where T: Unpin,

§

impl<T> UnwindSafe for ShortVec<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> Inner for T