Struct thrift_codec::data::Map
source · pub struct Map(/* private fields */);
Expand description
Map.
Internally this is represented by the data structure called “associative array”. No duplicate keys are removed.
Implementations§
source§impl Map
impl Map
sourcepub fn empty() -> Self
pub fn empty() -> Self
Makes an empty Map
instance.
Note that the returning value could not be encoded by the binary protocol encoding.
sourcepub fn from_keys_and_values(keys: Elements, values: Elements) -> Result<Self>
pub fn from_keys_and_values(keys: Elements, values: Elements) -> Result<Self>
Makes a new Map
instance from the separate keys
and values
.
Errors
If the lengths of keys
and values
are differed,
this function will return an error which kind is ErrorKind::InvalidInput
.
sourcepub fn get(&self, index: usize) -> Option<(DataRef<'_>, DataRef<'_>)>
pub fn get(&self, index: usize) -> Option<(DataRef<'_>, DataRef<'_>)>
Returns the entry placed at the specified index.
sourcepub fn value_kind(&self) -> Option<DataKind>
pub fn value_kind(&self) -> Option<DataKind>
Returns the kind of the values in this map.
Trait Implementations§
source§impl BinaryDecode for Map
impl BinaryDecode for Map
source§impl BinaryEncode for Map
impl BinaryEncode for Map
source§impl CompactDecode for Map
impl CompactDecode for Map
source§impl CompactEncode for Map
impl CompactEncode for Map
impl StructuralPartialEq for Map
Auto Trait Implementations§
impl RefUnwindSafe for Map
impl Send for Map
impl Sync for Map
impl Unpin for Map
impl UnwindSafe for Map
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