pub struct SymbolTable { /* private fields */ }
Expand description

Stores mappings from Symbol IDs to text and vice-versa.

Implementations

Constructs a new symbol table pre-populated with the system symbols defined in the spec.

If text is already in the symbol table, returns the corresponding SymbolId. Otherwise, adds text to the symbol table and returns the newly assigned SymbolId.

Assigns unknown text to the next available symbol ID. This is used when an Ion reader encounters null or non-string values in a stream’s symbol table.

If maybe_text is Some(text), this method is equivalent to intern(text). If maybe_text is None, this method is equivalent to add_placeholder().

If defined, returns the Symbol ID associated with the provided text.

If defined, returns the text associated with the provided Symbol ID.

If defined, returns the Symbol associated with the provided Symbol ID.

Returns true if the provided symbol ID maps to an entry in the symbol table (i.e. it is in the range of known symbols: 0 to max_id)

Note that a symbol ID can be valid but map to unknown text. If a symbol table contains a null or non-string value, that entry in the table will be defined but not have text associated with it.

This method allows users to distinguish between a SID with unknown text and a SID that is invalid.

Returns a slice of references to the symbol text stored in the table.

The symbol table can contain symbols with unknown text; if the text for a given symbol is unknown, the corresponding entry in the slice will be None.

Returns a slice of references to the symbol text stored in the table starting at the given symbol ID. If a symbol table append occurs during reading, this function can be used to easily view the new symbols that has been added to the table.

The symbol table can contain symbols with unknown text; if the text for a given symbol is unknown, the corresponding entry in the slice will be None.

Returns the number of symbols defined in the table.

Trait Implementations

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.