pub struct NamedItemTable<T> { /* private fields */ }
Available on crate feature table only.
Expand description

Helper class to work with named items stored as arrays in a BPX container.

Implementations

Constructs a new NamedItemTable from a list of items.

Arguments
  • list: the list of items.

returns: ItemTable

Constructs a new empty NamedItemTable.

Gets all items in this table.

Returns true if this table is empty.

Returns the number of items in this table.

Gets immutable access to an item by its index.

Returns None if the index is out of bounds.

Arguments
  • index: the index to find.

returns: Option<&T>

Gets mutable access to an item by its index.

Returns None if the index is out of bounds.

Arguments
  • index: the index to find.

returns: Option<&mut T>

Removes an item from this table.

Arguments
  • index: the index of the item to remove.

returns: ()

Load the name of an item.

Arguments
  • container: the container to load the string from.
  • strings: the string section to use for loading the string.
  • item: the item to load the string of.

returns: Result<&str, Error>

Errors

An Error is returned if the strings could not be loaded.

Adds a new item to this table.

Arguments
  • name: the name of the item to add.
  • item: the item to add.

returns: ()

Lookup an item by its name. Returns None if the item does not exist.

Arguments
  • container: the container to load strings from if needed.
  • strings: the string section to use for loading strings if needed.
  • name: the name to search for.

returns: Result<Option<&T>, Error>

Errors

A Error is returned if the strings could not be loaded.

Trait Implementations

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. 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.