Struct soroban_env_host::MeteredOrdMap
source · pub struct MeteredOrdMap<K, V> { /* private fields */ }
Implementations
sourceimpl<K, V> MeteredOrdMap<K, V>where
K: Ord + Clone,
V: Clone,
impl<K, V> MeteredOrdMap<K, V>where
K: Ord + Clone,
V: Clone,
pub fn new(budget: Budget) -> Result<Self, HostError>
pub fn from_map(budget: Budget, map: OrdMap<K, V>) -> Result<Self, HostError>
pub fn insert(&mut self, key: K, value: V) -> Result<Option<V>, HostError>
pub fn get<BK>(&self, key: &BK) -> Result<Option<&V>, HostError>where
BK: Ord + ?Sized,
K: Borrow<BK>,
pub fn remove<BK>(&mut self, k: &BK) -> Result<Option<V>, HostError>where
BK: Ord + ?Sized,
K: Borrow<BK>,
pub fn len(&self) -> usize
pub fn contains_key<BK>(&self, k: &BK) -> Result<bool, HostError>where
BK: Ord + ?Sized,
K: Borrow<BK>,
sourcepub fn extract<BK>(&self, k: &BK) -> Result<Option<(V, Self)>, HostError>where
BK: Ord + ?Sized,
K: Borrow<BK>,
pub fn extract<BK>(&self, k: &BK) -> Result<Option<(V, Self)>, HostError>where
BK: Ord + ?Sized,
K: Borrow<BK>,
Time: O(log n)
pub fn get_prev<BK>(&self, key: &BK) -> Result<Option<(&K, &V)>, HostError>where
BK: Ord + ?Sized,
K: Borrow<BK>,
pub fn get_next<BK>(&self, key: &BK) -> Result<Option<(&K, &V)>, HostError>where
BK: Ord + ?Sized,
K: Borrow<BK>,
pub fn keys(&self) -> Result<Keys<'_, K, V>, HostError>
pub fn values(&self) -> Result<Values<'_, K, V>, HostError>
pub fn iter(&self) -> Iter<'_, K, V>
Trait Implementations
sourceimpl<K, V> Clone for MeteredOrdMap<K, V>
impl<K, V> Clone for MeteredOrdMap<K, V>
sourceimpl<K, V> Default for MeteredOrdMap<K, V>
impl<K, V> Default for MeteredOrdMap<K, V>
sourceimpl<'a, K, V> IntoIterator for &'a MeteredOrdMap<K, V>where
K: Ord,
impl<'a, K, V> IntoIterator for &'a MeteredOrdMap<K, V>where
K: Ord,
sourceimpl<K, V> IntoIterator for MeteredOrdMap<K, V>where
K: Ord + Clone,
V: Clone,
impl<K, V> IntoIterator for MeteredOrdMap<K, V>where
K: Ord + Clone,
V: Clone,
sourceimpl<K, V> Ord for MeteredOrdMap<K, V>where
K: Ord,
V: Ord,
impl<K, V> Ord for MeteredOrdMap<K, V>where
K: Ord,
V: Ord,
1.21.0 · sourcefn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<K, V> PartialEq<MeteredOrdMap<K, V>> for MeteredOrdMap<K, V>where
K: Ord + PartialEq,
V: PartialEq,
impl<K, V> PartialEq<MeteredOrdMap<K, V>> for MeteredOrdMap<K, V>where
K: Ord + PartialEq,
V: PartialEq,
sourceimpl<K, V> PartialOrd<MeteredOrdMap<K, V>> for MeteredOrdMap<K, V>where
K: Ord,
V: PartialOrd,
impl<K, V> PartialOrd<MeteredOrdMap<K, V>> for MeteredOrdMap<K, V>where
K: Ord,
V: PartialOrd,
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
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 moreimpl<K: Ord + Eq, V: Eq> Eq for MeteredOrdMap<K, V>
Auto Trait Implementations
impl<K, V> !RefUnwindSafe for MeteredOrdMap<K, V>
impl<K, V> !Send for MeteredOrdMap<K, V>
impl<K, V> !Sync for MeteredOrdMap<K, V>
impl<K, V> Unpin for MeteredOrdMap<K, V>where
K: Unpin,
V: Unpin,
impl<K, V> !UnwindSafe for MeteredOrdMap<K, V>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
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
. Read morefn 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
. Read morefn 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. Read morefn 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. Read more