Struct soroban_sdk::Vec

source ·
pub struct Vec<T> { /* private fields */ }
Expand description

Vec is a sequential and indexable growable collection type.

Values are stored in the environment and are available to contract through the functions defined on Vec. Values stored in the Vec are transmitted to the environment as Vals, and when retrieved from the Vec are transmitted back and converted from Val back into their type.

The values in a Vec are not guaranteed to be of type T and conversion will fail if they are not. Most functions on Vec have a try_ variation that returns a Result that will be Err if the conversion fails. Functions that are not prefixed with try_ will panic if conversion fails.

There are some cases where this lack of guarantee is important:

  • When storing a Vec that has been provided externally as a contract function argument, be aware there is no guarantee that all items in the Vec will be of type T. It may be necessary to validate all values, either before storing, or when loading with try_ variation functions.

  • When accessing and iterating over a Vec that has been provided externally as a contract function input, and the contract needs to be resilient to failure, use the try_ variation functions.

Functions with an _unchecked suffix will panic if called with indexes that are out-of-bounds.

To store u8s and binary data, use Bytes/BytesN instead.

Vec values can be stored as Storage, or in other types like Vec, Map, etc.

§Examples

use soroban_sdk::{vec, Env};

let env = Env::default();
let vec = vec![&env, 0, 1, 2, 3];
assert_eq!(vec.len(), 4);

Implementations§

source§

impl<T> Vec<T>

source

pub fn env(&self) -> &Env

source

pub fn as_val(&self) -> &Val

source

pub fn to_val(&self) -> Val

source

pub fn as_object(&self) -> &VecObject

source

pub fn to_object(&self) -> VecObject

source

pub fn to_vals(&self) -> Vec<Val>

source§

impl<T> Vec<T>
where T: IntoVal<Env, Val> + TryFromVal<Env, Val>,

source

pub fn new(env: &Env) -> Vec<T>

Create an empty Vec.

source

pub fn from_array<const N: usize>(env: &Env, items: [T; N]) -> Vec<T>

Create a Vec from the array of items.

source

pub fn from_slice(env: &Env, items: &[T]) -> Vec<T>
where T: Clone,

Create a Vec from the slice of items.

source

pub fn get(&self, i: u32) -> Option<T>

Returns the item at the position or None if out-of-bounds.

§Panics

If the value at the position cannot be converted to type T.

source

pub fn try_get(&self, i: u32) -> Result<Option<T>, T::Error>

Returns the item at the position or None if out-of-bounds.

§Errors

If the value at the position cannot be converted to type T.

source

pub fn get_unchecked(&self, i: u32) -> T

Returns the item at the position.

§Panics

If the position is out-of-bounds.

If the value at the position cannot be converted to type T.

source

pub fn try_get_unchecked(&self, i: u32) -> Result<T, T::Error>

Returns the item at the position.

§Errors

If the value at the position cannot be converted to type T.

§Panics

If the position is out-of-bounds.

source

pub fn set(&mut self, i: u32, v: T)

Sets the item at the position with new value.

§Panics

If the position is out-of-bounds.

source

pub fn remove(&mut self, i: u32) -> Option<()>

Removes the item at the position.

Returns None if out-of-bounds.

source

pub fn remove_unchecked(&mut self, i: u32)

Removes the item at the position.

§Panics

If the position is out-of-bounds.

source

pub fn push_front(&mut self, x: T)

Adds the item to the front.

Increases the length by one, shifts all items up by one, and puts the item in the first position.

source

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

Removes and returns the first item or None if empty.

§Panics

If the value at the first position cannot be converted to type T.

source

pub fn try_pop_front(&mut self) -> Result<Option<T>, T::Error>

Removes and returns the first item or None if empty.

§Errors

If the value at the first position cannot be converted to type T.

source

pub fn pop_front_unchecked(&mut self) -> T

Removes and returns the first item.

§Panics

If the vec is empty.

If the value at the first position cannot be converted to type T.

source

pub fn try_pop_front_unchecked(&mut self) -> Result<T, T::Error>

Removes and returns the first item.

§Errors

If the value at the first position cannot be converted to type T.

§Panics

If the vec is empty.

source

pub fn push_back(&mut self, x: T)

Adds the item to the back.

Increases the length by one and puts the item in the last position.

source

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

Removes and returns the last item or None if empty.

§Panics

If the value at the last position cannot be converted to type T.

source

pub fn try_pop_back(&mut self) -> Result<Option<T>, T::Error>

Removes and returns the last item or None if empty.

§Errors

If the value at the last position cannot be converted to type T.

source

pub fn pop_back_unchecked(&mut self) -> T

Removes and returns the last item.

§Panics

If the vec is empty.

If the value at the last position cannot be converted to type T.

source

pub fn try_pop_back_unchecked(&mut self) -> Result<T, T::Error>

Removes and returns the last item.

§Errors

If the value at the last position cannot be converted to type T.

§Panics

If the vec is empty.

source

pub fn first(&self) -> Option<T>

Returns the first item or None if empty.

§Panics

If the value at the first position cannot be converted to type T.

source

pub fn try_first(&self) -> Result<Option<T>, T::Error>

Returns the first item or None if empty.

§Errors

If the value at the first position cannot be converted to type T.

source

pub fn first_unchecked(&self) -> T

Returns the first item.

§Panics

If the vec is empty.

If the value at the first position cannot be converted to type T.

source

pub fn try_first_unchecked(&self) -> Result<T, T::Error>

Returns the first item.

§Errors

If the value at the first position cannot be converted to type T.

§Panics

If the vec is empty.

source

pub fn last(&self) -> Option<T>

Returns the last item or None if empty.

§Panics

If the value at the last position cannot be converted to type T.

source

pub fn try_last(&self) -> Result<Option<T>, T::Error>

Returns the last item or None if empty.

§Errors

If the value at the last position cannot be converted to type T.

source

pub fn last_unchecked(&self) -> T

Returns the last item.

§Panics

If the vec is empty.

If the value at the last position cannot be converted to type T.

source

pub fn try_last_unchecked(&self) -> Result<T, T::Error>

Returns the last item.

§Errors

If the value at the last position cannot be converted to type T.

§Panics

If the vec is empty.

source

pub fn insert(&mut self, i: u32, x: T)

Inserts an item at the position.

§Panics

If the position is out-of-bounds.

source

pub fn append(&mut self, other: &Vec<T>)

Append the items.

source

pub fn extend_from_array<const N: usize>(&mut self, items: [T; N])

Extend with the items in the array.

source

pub fn extend_from_slice(&mut self, items: &[T])
where T: Clone,

Extend with the items in the slice.

source§

impl<T> Vec<T>

source

pub fn slice(&self, r: impl RangeBounds<u32>) -> Self

Returns a subset of the bytes as defined by the start and end bounds of the range.

§Panics

If the range is out-of-bounds.

source

pub fn shuffle(&mut self)

Returns copy of the vec shuffled using the NOT-SECURE PRNG.

In tests, must be called from within a running contract.

§Warning

The pseudo-random generator used to perform the shuffle is not suitable for security-sensitive work.

source

pub fn to_shuffled(&self) -> Self

Returns copy of the vec shuffled using the NOT-SECURE PRNG.

In tests, must be called from within a running contract.

§Warning

The pseudo-random generator used to perform the shuffle is not suitable for security-sensitive work.

source

pub fn is_empty(&self) -> bool

Returns true if the vec is empty and contains no items.

source

pub fn len(&self) -> u32

Returns the number of items in the vec.

source§

impl<T> Vec<T>
where T: IntoVal<Env, Val>,

source

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

Returns true if the Vec contains the item.

source

pub fn first_index_of(&self, item: impl Borrow<T>) -> Option<u32>

Returns the index of the first occurrence of the item.

If the item cannot be found None is returned.

source

pub fn last_index_of(&self, item: impl Borrow<T>) -> Option<u32>

Returns the index of the last occurrence of the item.

If the item cannot be found None is returned.

Returns the index of an occurrence of the item in an already sorted Vec, or the index of where the item can be inserted to keep the Vec sorted.

If the item is found, Result::Ok is returned containing the index of the item.

If the item is not found, Result::Err is returned containing the index of where the item could be inserted to retain the sorted ordering.

source§

impl<T> Vec<Vec<T>>
where T: IntoVal<Env, Val> + TryFromVal<Env, Val> + Clone,

source

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

source§

impl<T> Vec<T>
where T: IntoVal<Env, Val> + TryFromVal<Env, Val>,

source

pub fn iter(&self) -> UnwrappedIter<VecTryIter<T>, T, T::Error>
where T: IntoVal<Env, Val> + TryFromVal<Env, Val> + Clone, T::Error: Debug,

source

pub fn try_iter(&self) -> VecTryIter<T>
where T: IntoVal<Env, Val> + TryFromVal<Env, Val> + Clone,

source

pub fn into_try_iter(self) -> VecTryIter<T>
where T: IntoVal<Env, Val> + TryFromVal<Env, Val> + Clone, T::Error: Debug,

Trait Implementations§

source§

impl<T> Clone for Vec<T>

source§

fn clone(&self) -> Self

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> Debug for Vec<T>
where T: IntoVal<Env, Val> + TryFromVal<Env, Val> + Debug + Clone, T::Error: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T> From<Vec<T>> for Val
where T: IntoVal<Env, Val> + TryFromVal<Env, Val>,

source§

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

Converts to this type from the input type.
source§

impl<T> From<Vec<T>> for VecObject
where T: IntoVal<Env, Val> + TryFromVal<Env, Val>,

source§

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

Converts to this type from the input type.
source§

impl<T> IntoIterator for Vec<T>
where T: IntoVal<Env, Val> + TryFromVal<Env, Val>,

§

type Item = T

The type of the elements being iterated over.
§

type IntoIter = UnwrappedIter<VecTryIter<T>, T, <T as TryFromVal<Env, Val>>::Error>

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> Ord for Vec<T>
where T: IntoVal<Env, Val> + TryFromVal<Env, Val>,

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<T> PartialEq for Vec<T>
where T: IntoVal<Env, Val> + TryFromVal<Env, Val>,

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> PartialOrd for Vec<T>
where T: IntoVal<Env, Val> + TryFromVal<Env, Val>,

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

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

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

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

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

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

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

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

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

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

impl<T> Shuffle for Vec<T>

source§

fn shuffle(&mut self, prng: &Prng)

Shuffles the value with the Prng.
source§

impl<T> SorobanArbitrary for Vec<T>

Available on crate feature testutils only.
§

type Prototype = ArbitraryVec<<T as SorobanArbitrary>::Prototype>

A type that implements Arbitrary and can be converted to this SorobanArbitrary type.
source§

impl<T> TryFrom<&Vec<T>> for ScVal

§

type Error = ConversionError

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

fn try_from(v: &Vec<T>) -> Result<Self, ConversionError>

Performs the conversion.
source§

impl<T> TryFrom<&Vec<T>> for ScVec

§

type Error = ConversionError

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

fn try_from(v: &Vec<T>) -> Result<Self, ConversionError>

Performs the conversion.
source§

impl<T> TryFrom<Vec<T>> for ScVal

§

type Error = ConversionError

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

fn try_from(v: Vec<T>) -> Result<Self, ConversionError>

Performs the conversion.
source§

impl<T> TryFrom<Vec<T>> for ScVec

§

type Error = ConversionError

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

fn try_from(v: Vec<T>) -> Result<Self, ConversionError>

Performs the conversion.
source§

impl<T> TryFrom<Vec<T>> for VecM<ScVal>

§

type Error = ConversionError

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

fn try_from(v: Vec<T>) -> Result<Self, ConversionError>

Performs the conversion.
source§

impl<T> TryFromVal<Env, &Vec<Val>> for Vec<T>

§

type Error = Infallible

source§

fn try_from_val(env: &Env, v: &&Vec<Val>) -> Result<Self, Self::Error>

source§

impl TryFromVal<Env, ()> for Vec<Val>

§

type Error = ConversionError

source§

fn try_from_val(env: &Env, _v: &()) -> Result<Self, Self::Error>

source§

impl<T0> TryFromVal<Env, (T0,)> for Vec<Val>
where T0: IntoVal<Env, Val>,

§

type Error = ConversionError

source§

fn try_from_val(env: &Env, v: &(T0,)) -> Result<Self, Self::Error>

source§

impl<T0, T1> TryFromVal<Env, (T0, T1)> for Vec<Val>
where T0: IntoVal<Env, Val>, T1: IntoVal<Env, Val>,

§

type Error = ConversionError

source§

fn try_from_val(env: &Env, v: &(T0, T1)) -> Result<Self, Self::Error>

source§

impl<T0, T1, T2> TryFromVal<Env, (T0, T1, T2)> for Vec<Val>
where T0: IntoVal<Env, Val>, T1: IntoVal<Env, Val>, T2: IntoVal<Env, Val>,

source§

impl<T0, T1, T2, T3> TryFromVal<Env, (T0, T1, T2, T3)> for Vec<Val>
where T0: IntoVal<Env, Val>, T1: IntoVal<Env, Val>, T2: IntoVal<Env, Val>, T3: IntoVal<Env, Val>,

source§

impl<T0, T1, T2, T3, T4> TryFromVal<Env, (T0, T1, T2, T3, T4)> for Vec<Val>
where T0: IntoVal<Env, Val>, T1: IntoVal<Env, Val>, T2: IntoVal<Env, Val>, T3: IntoVal<Env, Val>, T4: IntoVal<Env, Val>,

source§

impl<T0, T1, T2, T3, T4, T5> TryFromVal<Env, (T0, T1, T2, T3, T4, T5)> for Vec<Val>
where T0: IntoVal<Env, Val>, T1: IntoVal<Env, Val>, T2: IntoVal<Env, Val>, T3: IntoVal<Env, Val>, T4: IntoVal<Env, Val>, T5: IntoVal<Env, Val>,

source§

impl<T0, T1, T2, T3, T4, T5, T6> TryFromVal<Env, (T0, T1, T2, T3, T4, T5, T6)> for Vec<Val>
where T0: IntoVal<Env, Val>, T1: IntoVal<Env, Val>, T2: IntoVal<Env, Val>, T3: IntoVal<Env, Val>, T4: IntoVal<Env, Val>, T5: IntoVal<Env, Val>, T6: IntoVal<Env, Val>,

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7> TryFromVal<Env, (T0, T1, T2, T3, T4, T5, T6, T7)> for Vec<Val>
where T0: IntoVal<Env, Val>, T1: IntoVal<Env, Val>, T2: IntoVal<Env, Val>, T3: IntoVal<Env, Val>, T4: IntoVal<Env, Val>, T5: IntoVal<Env, Val>, T6: IntoVal<Env, Val>, T7: IntoVal<Env, Val>,

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8> TryFromVal<Env, (T0, T1, T2, T3, T4, T5, T6, T7, T8)> for Vec<Val>
where T0: IntoVal<Env, Val>, T1: IntoVal<Env, Val>, T2: IntoVal<Env, Val>, T3: IntoVal<Env, Val>, T4: IntoVal<Env, Val>, T5: IntoVal<Env, Val>, T6: IntoVal<Env, Val>, T7: IntoVal<Env, Val>, T8: IntoVal<Env, Val>,

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> TryFromVal<Env, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)> for Vec<Val>
where T0: IntoVal<Env, Val>, T1: IntoVal<Env, Val>, T2: IntoVal<Env, Val>, T3: IntoVal<Env, Val>, T4: IntoVal<Env, Val>, T5: IntoVal<Env, Val>, T6: IntoVal<Env, Val>, T7: IntoVal<Env, Val>, T8: IntoVal<Env, Val>, T9: IntoVal<Env, Val>,

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> TryFromVal<Env, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)> for Vec<Val>
where T0: IntoVal<Env, Val>, T1: IntoVal<Env, Val>, T2: IntoVal<Env, Val>, T3: IntoVal<Env, Val>, T4: IntoVal<Env, Val>, T5: IntoVal<Env, Val>, T6: IntoVal<Env, Val>, T7: IntoVal<Env, Val>, T8: IntoVal<Env, Val>, T9: IntoVal<Env, Val>, T10: IntoVal<Env, Val>,

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> TryFromVal<Env, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)> for Vec<Val>
where T0: IntoVal<Env, Val>, T1: IntoVal<Env, Val>, T2: IntoVal<Env, Val>, T3: IntoVal<Env, Val>, T4: IntoVal<Env, Val>, T5: IntoVal<Env, Val>, T6: IntoVal<Env, Val>, T7: IntoVal<Env, Val>, T8: IntoVal<Env, Val>, T9: IntoVal<Env, Val>, T10: IntoVal<Env, Val>, T11: IntoVal<Env, Val>,

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> TryFromVal<Env, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)> for Vec<Val>
where T0: IntoVal<Env, Val>, T1: IntoVal<Env, Val>, T2: IntoVal<Env, Val>, T3: IntoVal<Env, Val>, T4: IntoVal<Env, Val>, T5: IntoVal<Env, Val>, T6: IntoVal<Env, Val>, T7: IntoVal<Env, Val>, T8: IntoVal<Env, Val>, T9: IntoVal<Env, Val>, T10: IntoVal<Env, Val>, T11: IntoVal<Env, Val>, T12: IntoVal<Env, Val>,

source§

impl<T> TryFromVal<Env, ScVal> for Vec<T>
where T: IntoVal<Env, Val> + TryFromVal<Env, Val>,

source§

impl<T> TryFromVal<Env, ScVec> for Vec<T>
where T: IntoVal<Env, Val> + TryFromVal<Env, Val>,

§

type Error = ConversionError

source§

fn try_from_val(env: &Env, val: &ScVec) -> Result<Self, Self::Error>

source§

impl<T> TryFromVal<Env, Val> for Vec<T>
where T: IntoVal<Env, Val> + TryFromVal<Env, Val>,

§

type Error = ConversionError

source§

fn try_from_val(env: &Env, val: &Val) -> Result<Self, Self::Error>

source§

impl<T> TryFromVal<Env, Vec<T>> for Val

§

type Error = ConversionError

source§

fn try_from_val(_env: &Env, v: &Vec<T>) -> Result<Self, Self::Error>

source§

impl<T> TryFromVal<Env, Vec<T>> for Vec<Val>

§

type Error = Infallible

source§

fn try_from_val(env: &Env, v: &Vec<T>) -> Result<Self, Self::Error>

source§

impl<T> TryFromVal<Env, VecM<ScVal>> for Vec<T>
where T: IntoVal<Env, Val> + TryFromVal<Env, Val>,

§

type Error = ConversionError

source§

fn try_from_val(env: &Env, val: &VecM<ScVal>) -> Result<Self, Self::Error>

source§

impl<T> TryFromVal<Env, VecObject> for Vec<T>
where T: IntoVal<Env, Val> + TryFromVal<Env, Val>,

§

type Error = Infallible

source§

fn try_from_val(env: &Env, obj: &VecObject) -> Result<Self, Self::Error>

source§

impl<T> Eq for Vec<T>
where T: IntoVal<Env, Val> + TryFromVal<Env, Val>,

Auto Trait Implementations§

§

impl<T> Freeze for Vec<T>

§

impl<T> !RefUnwindSafe for Vec<T>

§

impl<T> !Send for Vec<T>

§

impl<T> !Sync for Vec<T>

§

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

§

impl<T> !UnwindSafe for Vec<T>

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, C> Compare<&T> for C
where C: Compare<T>,

§

type Error = <C as Compare<T>>::Error

source§

fn compare(&self, a: &&T, b: &&T) -> Result<Ordering, <C as Compare<&T>>::Error>

source§

impl<T, U, E, C> Compare<(T, U)> for C
where C: Compare<T, Error = E, Error = E> + Compare<U>,

§

type Error = E

source§

fn compare( &self, a: &(T, U), b: &(T, U) ) -> Result<Ordering, <C as Compare<(T, U)>>::Error>

source§

impl<T, U, V, E, C> Compare<(T, U, V)> for C
where C: Compare<T, Error = E, Error = E, Error = E> + Compare<U> + Compare<V>,

§

type Error = E

source§

fn compare( &self, a: &(T, U, V), b: &(T, U, V) ) -> Result<Ordering, <C as Compare<(T, U, V)>>::Error>

source§

impl<T, U, V, W, E, C> Compare<(T, U, V, W)> for C
where C: Compare<T, Error = E, Error = E, Error = E, Error = E> + Compare<U> + Compare<V> + Compare<W>,

source§

impl<T, U, V, W, X, E, C> Compare<(T, U, V, W, X)> for C
where C: Compare<T, Error = E, Error = E, Error = E, Error = E, Error = E> + Compare<U> + Compare<V> + Compare<W> + Compare<X>,

source§

impl<T, C> Compare<Box<T>> for C
where C: Compare<T>,

§

type Error = <C as Compare<T>>::Error

source§

fn compare( &self, a: &Box<T>, b: &Box<T> ) -> Result<Ordering, <C as Compare<Box<T>>>::Error>

source§

impl<T, C> Compare<Option<T>> for C
where C: Compare<T>,

§

type Error = <C as Compare<T>>::Error

source§

fn compare( &self, a: &Option<T>, b: &Option<T> ) -> Result<Ordering, <C as Compare<Option<T>>>::Error>

source§

impl<T, C> Compare<Rc<T>> for C
where C: Compare<T>,

§

type Error = <C as Compare<T>>::Error

source§

fn compare( &self, a: &Rc<T>, b: &Rc<T> ) -> Result<Ordering, <C as Compare<Rc<T>>>::Error>

source§

impl<T, C> Compare<Vec<T>> for C
where C: Compare<T>,

§

type Error = <C as Compare<T>>::Error

source§

fn compare( &self, a: &Vec<T>, b: &Vec<T> ) -> Result<Ordering, <C as Compare<Vec<T>>>::Error>

source§

impl<T> Downcast for T
where T: Any,

source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<E, T, U> FromVal<E, T> for U
where E: Env, U: TryFromVal<E, T>,

source§

fn from_val(e: &E, v: &T) -> U

source§

impl<T> FromXdr for T
where T: TryFromVal<Env, Val>,

§

type Error = <T as TryFromVal<Env, Val>>::Error

source§

fn from_xdr(env: &Env, b: &Bytes) -> Result<T, <T as FromXdr>::Error>

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<E, T, U> IntoVal<E, T> for U
where E: Env, T: FromVal<E, U>,

source§

fn into_val(&self, e: &E) -> T

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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> ToShuffled for T
where T: Shuffle + Clone,

§

type Shuffled = T

source§

fn to_shuffled(&self, prng: &Prng) -> T

source§

impl<T> ToXdr for T
where T: IntoVal<Env, Val>,

source§

fn to_xdr(self, env: &Env) -> Bytes

source§

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

§

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>,

§

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<E, T, U> TryIntoVal<E, T> for U
where E: Env, T: TryFromVal<E, U>,

§

type Error = <T as TryFromVal<E, U>>::Error

source§

fn try_into_val(&self, env: &E) -> Result<T, <U as TryIntoVal<E, T>>::Error>

source§

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

source§

fn vzip(self) -> V