Type Alias pot::de::SymbolMap

source ·
pub type SymbolMap = SymbolList<'static>;
Expand description

An alias to a SymbolList with a static lifetime. This type persists symbols referenced across multiple deserialization sessions.

Aliased Type§

struct SymbolMap { /* private fields */ }

Implementations§

source§

impl SymbolMap

source

pub fn deserializer_for_slice<'a, 'de>( &'a mut self, slice: &'de [u8], ) -> Result<Deserializer<'a, 'de, SliceReader<'de>>>

Returns a deserializer for slice that reuses symbol ids.

This should only be used with data generated by using a persistent ser::SymbolMap.

source

pub fn deserializer_for<'de, R>( &mut self, reader: R, ) -> Result<Deserializer<'_, 'de, IoReader<R>>>
where R: Read,

Returns a deserializer for reader.

This should only be used with data generated by using a persistent ser::SymbolMap.

source

pub fn deserialize_slice<'de, T>(&mut self, slice: &'de [u8]) -> Result<T>
where T: Deserialize<'de>,

Deserializes T from slice.

This should only be used with data generated by using a persistent ser::SymbolMap.

source

pub fn deserialize_from<'de, T>(&mut self, reader: impl Read) -> Result<T>
where T: Deserialize<'de>,

Deserializes T from reader.

This should only be used with data generated by using a persistent ser::SymbolMap.

source§

impl<'de> SymbolList<'de>

source

pub const fn new() -> Self

Returns a new, empty symbol list.

source

pub fn push_borrowed(&mut self, borrowed: &'de str)

Push a symbol that has been borrowed from the deserialization source.

source

pub fn push(&mut self, ephemeral: &str)

Push a symbol that cannot be borrowed from the deserialization source.

source

pub fn get(&self, index: usize) -> Option<SymbolStr<'de, '_>>

Return the symbol stored at index, or None if index is out of bounds.

source

pub fn len(&self) -> usize

Returns the number of entries in the symbol list.

source

pub fn is_empty(&self) -> bool

Returns true if there are no symbols in this list.

Trait Implementations§

source§

impl<'de> Deserialize<'de> for SymbolMap

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for SymbolMap

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<'de> Debug for SymbolList<'de>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for SymbolList<'_>

source§

fn default() -> Self

Returns the “default value” for a type. Read more