pub struct Dict<'k, 'v> { /* private fields */ }
Expand description
Implementations§
source§impl<'k, 'v> Dict<'k, 'v>
impl<'k, 'v> Dict<'k, 'v>
sourcepub fn new(key_signature: Signature<'k>, value_signature: Signature<'v>) -> Self
pub fn new(key_signature: Signature<'k>, value_signature: Signature<'v>) -> Self
Create a new empty Dict
, given the signature of the keys and values.
sourcepub fn append<'kv: 'k, 'vv: 'v>(
&mut self,
key: Value<'kv>,
value: Value<'vv>,
) -> Result<(), Error>
pub fn append<'kv: 'k, 'vv: 'v>( &mut self, key: Value<'kv>, value: Value<'vv>, ) -> Result<(), Error>
Append key
and value
as a new entry.
§Errors
- if
key.value_signature()
doesn’t match the key signatureself
was created for. - if
value.value_signature()
doesn’t match the value signatureself
was created for.
sourcepub fn get<'d, K, V>(&'d self, key: &K) -> Result<Option<&'v V>, Error>
pub fn get<'d, K, V>(&'d self, key: &K) -> Result<Option<&'v V>, Error>
Get the value for the given key.
sourcepub fn signature(&self) -> Signature<'static>
pub fn signature(&self) -> Signature<'static>
Get the signature of this Dict
.
NB: This method potentially allocates and copies. Use full_signature
if you’d like to
avoid that.
sourcepub fn full_signature(&self) -> &Signature<'_>
pub fn full_signature(&self) -> &Signature<'_>
Get the signature of this Dict
.
Trait Implementations§
source§impl<'a> From<Dict<'a, 'a>> for OwnedValue
impl<'a> From<Dict<'a, 'a>> for OwnedValue
source§impl<'a> TryFrom<&'a OwnedValue> for &'a Dict<'a, 'a>
impl<'a> TryFrom<&'a OwnedValue> for &'a Dict<'a, 'a>
source§impl TryFrom<OwnedValue> for Dict<'static, 'static>
impl TryFrom<OwnedValue> for Dict<'static, 'static>
impl<'k, 'v> StructuralPartialEq for Dict<'k, 'v>
Auto Trait Implementations§
impl<'k, 'v> Freeze for Dict<'k, 'v>
impl<'k, 'v> RefUnwindSafe for Dict<'k, 'v>
impl<'k, 'v> Send for Dict<'k, 'v>
impl<'k, 'v> Sync for Dict<'k, 'v>
impl<'k, 'v> Unpin for Dict<'k, 'v>
impl<'k, 'v> UnwindSafe for Dict<'k, 'v>
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)