Struct soroban_env_host::MeteredOrdMap
source · pub struct MeteredOrdMap<K, V, Ctx>where
K: MeteredClone,
V: MeteredClone,
Ctx: AsBudget + Compare<K, Error = HostError> + Compare<V, Error = HostError>,{ /* private fields */ }
Implementations§
source§impl<K, V, Ctx> MeteredOrdMap<K, V, Ctx>where
K: MeteredClone,
V: MeteredClone,
Ctx: AsBudget + Compare<K, Error = HostError> + Compare<V, Error = HostError>,
impl<K, V, Ctx> MeteredOrdMap<K, V, Ctx>where K: MeteredClone, V: MeteredClone, Ctx: AsBudget + Compare<K, Error = HostError> + Compare<V, Error = HostError>,
pub fn new(ctx: &Ctx) -> Result<Self, HostError>
pub fn from_map(map: Vec<(K, V)>, ctx: &Ctx) -> Result<Self, HostError>
pub fn from_exact_iter<I: Iterator<Item = (K, V)>>( iter: I, ctx: &Ctx ) -> Result<Self, HostError>
pub fn insert(&self, key: K, value: V, ctx: &Ctx) -> Result<Self, HostError>
pub fn get<Q>(&self, key: &Q, ctx: &Ctx) -> Result<Option<&V>, HostError>where K: Borrow<Q>, Ctx: Compare<Q, Error = HostError>,
sourcepub fn remove<Q>(
&self,
key: &Q,
ctx: &Ctx
) -> Result<Option<(Self, V)>, HostError>where
K: Borrow<Q>,
Ctx: Compare<Q, Error = HostError>,
pub fn remove<Q>( &self, key: &Q, ctx: &Ctx ) -> Result<Option<(Self, V)>, HostError>where K: Borrow<Q>, Ctx: Compare<Q, Error = HostError>,
Returns a Some((new_self, val))
pair where new_self
no longer
contains an entry for key
, if the key existed, otherwise None
if
key
didn’t exist (in which case there’s no need to clone).
pub fn len(&self) -> usize
pub fn contains_key<Q>(&self, key: &Q, ctx: &Ctx) -> Result<bool, HostError>where K: Borrow<Q>, Ctx: Compare<Q, Error = HostError>,
pub fn get_prev<Q>( &self, key: &Q, ctx: &Ctx ) -> Result<Option<&(K, V)>, HostError>where K: Borrow<Q>, Ctx: Compare<Q, Error = HostError>,
pub fn get_next<Q>( &self, key: &Q, ctx: &Ctx ) -> Result<Option<&(K, V)>, HostError>where K: Borrow<Q>, Ctx: Compare<Q, Error = HostError>,
pub fn get_min<Q>(&self, ctx: &Ctx) -> Result<Option<&(K, V)>, HostError>where K: Borrow<Q>, Ctx: Compare<Q, Error = HostError>,
pub fn get_max<Q>(&self, ctx: &Ctx) -> Result<Option<&(K, V)>, HostError>where K: Borrow<Q>, Ctx: Compare<Q, Error = HostError>,
pub fn keys(&self, ctx: &Ctx) -> Result<impl Iterator<Item = &K>, HostError>
pub fn values(&self, ctx: &Ctx) -> Result<impl Iterator<Item = &V>, HostError>
pub fn iter( &self, ctx: &Ctx ) -> Result<impl Iterator<Item = &(K, V)>, HostError>
Trait Implementations§
source§impl<K, V, Ctx> Clone for MeteredOrdMap<K, V, Ctx>where
K: MeteredClone,
V: MeteredClone,
Ctx: AsBudget + Compare<K, Error = HostError> + Compare<V, Error = HostError>,
impl<K, V, Ctx> Clone for MeteredOrdMap<K, V, Ctx>where K: MeteredClone, V: MeteredClone, Ctx: AsBudget + Compare<K, Error = HostError> + Compare<V, Error = HostError>,
Clone
should not be used directly, used MeteredClone
instead if possible. It is defined to
satisfy trait requirements.
source§impl<K, V> Compare<MeteredOrdMap<K, V, Budget>> for Budgetwhere
K: MeteredClone,
V: MeteredClone,
Budget: Compare<K, Error = HostError> + Compare<V, Error = HostError>,
impl<K, V> Compare<MeteredOrdMap<K, V, Budget>> for Budgetwhere K: MeteredClone, V: MeteredClone, Budget: Compare<K, Error = HostError> + Compare<V, Error = HostError>,
source§impl<K, V> Compare<MeteredOrdMap<K, V, Host>> for Hostwhere
K: MeteredClone,
V: MeteredClone,
Host: Compare<K, Error = HostError> + Compare<V, Error = HostError>,
impl<K, V> Compare<MeteredOrdMap<K, V, Host>> for Hostwhere K: MeteredClone, V: MeteredClone, Host: Compare<K, Error = HostError> + Compare<V, Error = HostError>,
source§impl<K, V, Ctx> Default for MeteredOrdMap<K, V, Ctx>where
K: MeteredClone,
V: MeteredClone,
Ctx: AsBudget + Compare<K, Error = HostError> + Compare<V, Error = HostError>,
impl<K, V, Ctx> Default for MeteredOrdMap<K, V, Ctx>where K: MeteredClone, V: MeteredClone, Ctx: AsBudget + Compare<K, Error = HostError> + Compare<V, Error = HostError>,
source§impl<'a, K, V, Ctx> IntoIterator for &'a MeteredOrdMap<K, V, Ctx>where
K: MeteredClone,
V: MeteredClone,
Ctx: AsBudget + Compare<K, Error = HostError> + Compare<V, Error = HostError>,
impl<'a, K, V, Ctx> IntoIterator for &'a MeteredOrdMap<K, V, Ctx>where K: MeteredClone, V: MeteredClone, Ctx: AsBudget + Compare<K, Error = HostError> + Compare<V, Error = HostError>,
source§impl<K, V, Ctx> IntoIterator for MeteredOrdMap<K, V, Ctx>where
K: MeteredClone,
V: MeteredClone,
Ctx: AsBudget + Compare<K, Error = HostError> + Compare<V, Error = HostError>,
impl<K, V, Ctx> IntoIterator for MeteredOrdMap<K, V, Ctx>where K: MeteredClone, V: MeteredClone, Ctx: AsBudget + Compare<K, Error = HostError> + Compare<V, Error = HostError>,
Auto Trait Implementations§
impl<K, V, Ctx> RefUnwindSafe for MeteredOrdMap<K, V, Ctx>where Ctx: RefUnwindSafe, K: RefUnwindSafe, V: RefUnwindSafe,
impl<K, V, Ctx> Send for MeteredOrdMap<K, V, Ctx>where Ctx: Send, K: Send, V: Send,
impl<K, V, Ctx> Sync for MeteredOrdMap<K, V, Ctx>where Ctx: Sync, K: Sync, V: Sync,
impl<K, V, Ctx> Unpin for MeteredOrdMap<K, V, Ctx>where Ctx: Unpin, K: Unpin, V: Unpin,
impl<K, V, Ctx> UnwindSafe for MeteredOrdMap<K, V, Ctx>where Ctx: UnwindSafe, K: UnwindSafe, V: UnwindSafe,
Blanket Implementations§
source§impl<T, U, E, C> Compare<(T, U)> for Cwhere
C: Compare<T, Error = E, Error = E> + Compare<U>,
impl<T, U, E, C> Compare<(T, U)> for Cwhere C: Compare<T, Error = E, Error = E> + Compare<U>,
source§impl<T, U, V, E, C> Compare<(T, U, V)> for Cwhere
C: Compare<T, Error = E, Error = E, Error = E> + Compare<U> + Compare<V>,
impl<T, U, V, E, C> Compare<(T, U, V)> for Cwhere C: Compare<T, Error = E, Error = E, Error = E> + Compare<U> + Compare<V>,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
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.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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.