pub struct MapEntry<'a, 'r, K, V, R: BorrowedReader + 'r> { /* private fields */ }Expand description
One key+value pair inside a MapWalker.
The cursor is positioned at the start of the key. The caller must first
handle the key (decode_key or skip_key) and then the value
(decode_value, skip_value, or walk_value). decode_pair and
skip_pair shortcut both at once.
Calling methods out of order returns Error::Deserialize in all builds
(not only debug builds), without advancing the reader when the check fails
before I/O.
Implementations§
Source§impl<'a, 'r, K, V, R: BorrowedReader + 'r> MapEntry<'a, 'r, K, V, R>
impl<'a, 'r, K, V, R: BorrowedReader + 'r> MapEntry<'a, 'r, K, V, R>
Sourcepub fn decode_key(&mut self) -> Result<K, Error>where
K: DeserializeRevisioned,
pub fn decode_key(&mut self) -> Result<K, Error>where
K: DeserializeRevisioned,
Decode the key. The cursor advances to the value.
Sourcepub fn skip_key(&mut self) -> Result<(), Error>where
K: SkipRevisioned,
pub fn skip_key(&mut self) -> Result<(), Error>where
K: SkipRevisioned,
Skip the key. The cursor advances to the value.
Sourcepub fn decode_value(self) -> Result<V, Error>where
V: DeserializeRevisioned,
pub fn decode_value(self) -> Result<V, Error>where
V: DeserializeRevisioned,
Decode the value (key must already be consumed).
Sourcepub fn skip_value(self) -> Result<(), Error>where
V: SkipRevisioned,
pub fn skip_value(self) -> Result<(), Error>where
V: SkipRevisioned,
Skip the value (key must already be consumed).
Sourcepub fn walk_value(self) -> Result<V::Walker<'a, R>, Error>where
V: WalkRevisioned,
pub fn walk_value(self) -> Result<V::Walker<'a, R>, Error>where
V: WalkRevisioned,
Walk into the value. The parent map walker is borrowed for the returned walker’s lifetime.
Sourcepub fn decode_pair(self) -> Result<(K, V), Error>where
K: DeserializeRevisioned,
V: DeserializeRevisioned,
pub fn decode_pair(self) -> Result<(K, V), Error>where
K: DeserializeRevisioned,
V: DeserializeRevisioned,
Decode key and value together, advancing past the entry.
Sourcepub fn skip_pair(self) -> Result<(), Error>where
K: SkipRevisioned,
V: SkipRevisioned,
pub fn skip_pair(self) -> Result<(), Error>where
K: SkipRevisioned,
V: SkipRevisioned,
Skip key and value together, advancing past the entry.
Source§impl<'a, 'r, K, V, R> MapEntry<'a, 'r, K, V, R>where
R: BorrowedReader + 'r,
impl<'a, 'r, K, V, R> MapEntry<'a, 'r, K, V, R>where
R: BorrowedReader + 'r,
Sourcepub fn with_key_bytes<F, U>(&mut self, f: F) -> Result<U, Error>
pub fn with_key_bytes<F, U>(&mut self, f: F) -> Result<U, Error>
Inspect the entry’s key as raw wire bytes without allocating.
Available when the key type’s wire format is usize len || raw bytes (LengthPrefixedBytes) and the reader is slice-backed
(BorrowedReader). The cursor advances past the key once f
returns; the caller must then handle the value
(decode_value / skip_value / walk_value).
Cheaper sibling of decode_key for the
common case “compare key bytes against a needle and decide what
to do with the value”.
Sourcepub fn with_value_bytes<F, U>(self, f: F) -> Result<U, Error>
pub fn with_value_bytes<F, U>(self, f: F) -> Result<U, Error>
Inspect the entry’s value as raw wire bytes without allocating (key must already be consumed).
Available when the value type’s wire format is usize len || raw bytes (LengthPrefixedBytes) and the reader is slice-backed
(BorrowedReader). Consumes the entry; the entry’s
remaining counter is decremented.
Cheaper sibling of decode_value for the
“filter map by value bytes” pattern.