soroban_env_host

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 Compare<&[u8]> for Budget

Source§

impl Compare<ContractDataDurability> for Budget

Source§

impl Compare<ContractDataDurability> for Host

Source§

impl Compare<ContractExecutable> for Budget

Source§

impl Compare<ContractExecutable> for Host

Source§

impl Compare<LedgerKey> for Budget

Source§

impl Compare<PublicKey> for Budget

Source§

impl Compare<PublicKey> for Host

Source§

impl Compare<ScAddress> for Budget

Source§

impl Compare<ScAddress> for Host

Source§

impl Compare<ScError> for Budget

Source§

impl Compare<ScError> for Host

Source§

impl Compare<ScVal> for Budget

Source§

impl Compare<TrustLineAsset> for Budget

Source§

impl Compare<TrustLineAsset> for Host

Source§

impl Compare<bool> for Budget

Source§

impl Compare<bool> for Host

Source§

impl Compare<i32> for Budget

Source§

impl Compare<i32> for Host

Source§

impl Compare<i64> for Budget

Source§

impl Compare<i64> for Host

Source§

impl Compare<i128> for Budget

Source§

impl Compare<i128> for Host

Source§

impl Compare<u32> for Budget

Source§

impl Compare<u32> for Host

Source§

impl Compare<u64> for Budget

Source§

impl Compare<u64> for Host

Source§

impl Compare<u128> for Budget

Source§

impl Compare<u128> for Host

Source§

impl Compare<I256> for Budget

Source§

impl Compare<I256> for Host

Source§

impl Compare<SymbolStr> for Budget

Source§

impl Compare<U256> for Budget

Source§

impl Compare<U256> for Host

Source§

impl Compare<AccountId> for Budget

Source§

impl Compare<AccountId> for Host

Source§

impl Compare<CreateContractArgs> for Budget

Source§

impl Compare<CreateContractArgs> for Host

Source§

impl Compare<CreateContractArgsV2> for Budget

Source§

impl Compare<CreateContractArgsV2> for Host

Source§

impl Compare<Duration> for Budget

Source§

impl Compare<Duration> for Host

Source§

impl Compare<Hash> for Budget

Source§

impl Compare<Hash> for Host

Source§

impl Compare<Int128Parts> for Budget

Source§

impl Compare<Int128Parts> for Host

Source§

impl Compare<Int256Parts> for Budget

Source§

impl Compare<Int256Parts> for Host

Source§

impl Compare<LedgerKeyAccount> for Budget

Source§

impl Compare<LedgerKeyAccount> for Host

Source§

impl Compare<LedgerKeyContractCode> for Budget

Source§

impl Compare<LedgerKeyContractCode> for Host

Source§

impl Compare<LedgerKeyContractData> for Budget

Source§

impl Compare<LedgerKeyTrustLine> for Budget

Source§

impl Compare<LedgerKeyTrustLine> for Host

Source§

impl Compare<ScContractInstance> for Budget

Source§

impl Compare<ScMap> for Budget

Source§

impl Compare<ScMapEntry> for Budget

Source§

impl Compare<ScNonceKey> for Budget

Source§

impl Compare<ScNonceKey> for Host

Source§

impl Compare<ScVec> for Budget

Source§

impl Compare<TimePoint> for Budget

Source§

impl Compare<TimePoint> for Host

Source§

impl Compare<UInt128Parts> for Budget

Source§

impl Compare<UInt128Parts> for Host

Source§

impl Compare<UInt256Parts> for Budget

Source§

impl Compare<UInt256Parts> for Host

Source§

impl Compare<Uint256> for Budget

Source§

impl Compare<Uint256> for Host

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

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

Source§

type Error = <E as EnvBase>::Error

Source§

impl<Elt: MeteredClone> Compare<MeteredVector<Elt>> for Budget
where Budget: Compare<Elt, Error = HostError>,

Source§

impl<Elt: MeteredClone> Compare<MeteredVector<Elt>> for Host
where Host: Compare<Elt, Error = HostError>,

Source§

impl<K, V> Compare<MeteredOrdMap<K, V, Budget>> for Budget
where K: DeclaredSizeForMetering, V: DeclaredSizeForMetering, Budget: Compare<K, Error = HostError> + Compare<V, Error = HostError>,

Source§

impl<K, V> Compare<MeteredOrdMap<K, V, Host>> for Host
where K: DeclaredSizeForMetering, V: DeclaredSizeForMetering, Host: Compare<K, Error = HostError> + Compare<V, Error = HostError>,

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

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, Error = E> + Compare<U>,

Source§

type Error = E

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

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, Error = E, Error = E, Error = E> + Compare<U> + Compare<V> + Compare<W>,

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, Error = E, Error = E, Error = E, Error = E> + Compare<U> + Compare<V> + Compare<W> + Compare<X>,

Source§

type Error = E

Source§

impl<const N: usize> Compare<[u8; N]> for Budget