pub struct SymbolMap { /* private fields */ }
Expand description
A list of previously serialized symbols.
Implementations§
§impl SymbolMap
impl SymbolMap
pub fn serializer_for<W>(
&mut self,
output: W
) -> Result<Serializer<'_, W>, Error>where
W: WriteBytesExt,
pub fn serializer_for<W>(
&mut self,
output: W
) -> Result<Serializer<'_, W>, Error>where
W: WriteBytesExt,
Returns a serializer that writes into output
and persists symbols
into self
.
pub fn serialize_to<T, W>(&mut self, writer: W, value: &T) -> Result<(), Error>
pub fn serialize_to<T, W>(&mut self, writer: W, value: &T) -> Result<(), Error>
Serializes value
into writer
while persisting symbols into self
.
pub fn serialize_to_vec<T>(&mut self, value: &T) -> Result<Vec<u8>, Error>where
T: Serialize,
pub fn serialize_to_vec<T>(&mut self, value: &T) -> Result<Vec<u8>, Error>where
T: Serialize,
Serializes value
into a new Vec<u8>
while persisting symbols into
self
.
pub fn insert(&mut self, symbol: &str) -> bool
pub fn insert(&mut self, symbol: &str) -> bool
Inserts symbol
into this map.
Returns true if this symbol had not previously been registered. Returns false if the symbol was already included in the map.
pub fn populate_from<T>(
&mut self,
value: &T
) -> Result<usize, SymbolMapPopulationError>where
T: Serialize,
pub fn populate_from<T>(
&mut self,
value: &T
) -> Result<usize, SymbolMapPopulationError>where
T: Serialize,
Adds all symbols encountered in value
.
Returns the number of symbols added.
Due to how serde works, this function can only encounter symbols that
are being used. For example, if T
is an enum, only variant being
passed in will have its name, and additional calls for each variant will
be needed to ensure every symbol is added.
Trait Implementations§
§impl<'de> Deserialize<'de> for SymbolMap
impl<'de> Deserialize<'de> for SymbolMap
§fn deserialize<D>(
deserializer: D
) -> Result<SymbolMap, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<SymbolMap, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl Serialize for SymbolMap
impl Serialize for SymbolMap
§fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl RefUnwindSafe for SymbolMap
impl Send for SymbolMap
impl Sync for SymbolMap
impl Unpin for SymbolMap
impl UnwindSafe for SymbolMap
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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