soroban_env_common

Trait Compare

Source
pub trait Compare<T> {
    type Error;

    // Required method
    fn compare(&self, a: &T, b: &T) -> Result<Ordering, Self::Error>;
}
Expand description

General trait representing the ability to compare two values of some type. Similar to core::cmp::Cmp but with two key differences: the comparison is fallible, and is provided by some external type implementing Compare rather than the compared type itself.

This trait exists to support comparing Vals with help from the environment in which object handles are defined, and allowing for the possibility of erroneous inputs like invalid object handles, as well as the possibility of running over budget during the comparison. It is also used in other places where comparison work has to be budgeted, such as inside the host’s storage maps.

Required Associated Types§

Required Methods§

Source

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

Implementors§

Source§

impl<E: Env> Compare<DurationObject> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<DurationSmall> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<I32Val> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<I64Object> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<I64Small> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<I128Object> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<I128Small> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<I256Object> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<I256Small> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<TimepointObject> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<TimepointSmall> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<U32Val> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<U64Object> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<U64Small> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<U128Object> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<U128Small> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<U256Object> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<U256Small> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<AddressObject> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<Bool> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<BytesObject> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<Error> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<MapObject> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<Object> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<StringObject> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<Symbol> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<SymbolObject> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<SymbolSmall> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<Val> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<VecObject> for E

Source§

type Error = <E as EnvBase>::Error

Source§

impl<E: Env> Compare<Void> for E

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

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

Source§

impl<T, C: Compare<T>> Compare<&T> for C

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

type Error = E

Source§

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

Source§

type Error = E

Source§

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

Source§

type Error = E

Source§

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

Source§

type Error = E