pub struct MeteredOrdMap<K, V, Ctx> { /* private fields */ }
Implementations§
Source§impl<K, V, Ctx> MeteredOrdMap<K, V, Ctx>
impl<K, V, Ctx> MeteredOrdMap<K, V, Ctx>
pub fn new() -> Self
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>
pub fn get_at_index( &self, index: usize, ctx: &Ctx, ) -> Result<&(K, V), HostError>
Sourcepub fn remove<Q>(
&self,
key: &Q,
ctx: &Ctx,
) -> Result<Option<(Self, V)>, HostError>
pub fn remove<Q>( &self, key: &Q, ctx: &Ctx, ) -> Result<Option<(Self, V)>, 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>
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,
Clone
should not be used directly, used MeteredClone
instead if
possible. Clone
is defined here to satisfy trait requirements.
impl<K, V, Ctx> Clone for MeteredOrdMap<K, V, Ctx>where
K: MeteredClone,
V: MeteredClone,
Ctx: AsBudget,
Clone
should not be used directly, used MeteredClone
instead if
possible. Clone
is defined here to satisfy trait requirements.
Source§impl<K, V, Ctx> Default for MeteredOrdMap<K, V, Ctx>where
Ctx: Default,
impl<K, V, Ctx> Default for MeteredOrdMap<K, V, Ctx>where
Ctx: Default,
Source§impl<K, V, Ctx> Hash for MeteredOrdMap<K, V, Ctx>
impl<K, V, Ctx> Hash for MeteredOrdMap<K, V, Ctx>
Source§impl<'a, K, V, Ctx> IntoIterator for &'a MeteredOrdMap<K, V, Ctx>
impl<'a, K, V, Ctx> IntoIterator for &'a MeteredOrdMap<K, V, Ctx>
Source§impl<K, V, Ctx> IntoIterator for MeteredOrdMap<K, V, Ctx>
impl<K, V, Ctx> IntoIterator for MeteredOrdMap<K, V, Ctx>
Auto Trait Implementations§
impl<K, V, Ctx> Freeze for MeteredOrdMap<K, V, Ctx>
impl<K, V, Ctx> RefUnwindSafe for MeteredOrdMap<K, V, Ctx>
impl<K, V, Ctx> Send for MeteredOrdMap<K, V, Ctx>
impl<K, V, Ctx> Sync for MeteredOrdMap<K, V, Ctx>
impl<K, V, Ctx> Unpin for MeteredOrdMap<K, V, Ctx>
impl<K, V, Ctx> UnwindSafe for MeteredOrdMap<K, V, Ctx>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, U, V, W, E, C> Compare<(T, U, V, W)> for C
impl<T, U, V, W, E, C> Compare<(T, U, V, W)> for C
type Error = E
fn compare( &self, a: &(T, U, V, W), b: &(T, U, V, W), ) -> Result<Ordering, <C as Compare<(T, U, V, W)>>::Error>
Source§impl<T, U, V, W, X, E, C> Compare<(T, U, V, W, X)> for C
impl<T, U, V, W, X, E, C> Compare<(T, U, V, W, X)> for C
type Error = E
fn compare( &self, a: &(T, U, V, W, X), b: &(T, U, V, W, X), ) -> Result<Ordering, <C as Compare<(T, U, V, W, X)>>::Error>
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
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>
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)
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)
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.