Trait il2_iltags::tags::ILTag[][src]

pub trait ILTag: Any + Send {
    fn id(&self) -> u64;
fn value_size(&self) -> u64;
fn serialize_value(&self, writer: &mut dyn Writer) -> Result<()>;
fn deserialize_value(
        &mut self,
        factory: &dyn ILTagFactory,
        value_size: usize,
        reader: &mut dyn Reader
    ) -> Result<()>;
fn as_any(&self) -> &dyn Any;
fn as_mut_any(&mut self) -> &mut dyn Any; fn is_implicity(&self) -> bool { ... }
fn is_reserved(&self) -> bool { ... }
fn size(&self) -> u64 { ... }
fn serialize(&self, writer: &mut dyn Writer) -> Result<()> { ... } }
Expand description

This trait must be implemented by all ILTags on this library. It defines the basic methods for tag identification, serialization and deserialization of values.

The actual manipulation of the information inside the tags must be handled directly by each tag implementation by the use of std::any::Any trait.

Required methods

Returns the ID of the tag.

Retuns the size of the serialized value in bytes.

Serializes the payload of this tag.

Arguments:

  • writer: The writer that will receive the encoded value;

Returns:

  • Ok(): On success.
  • Err(()): If the buffer is too small to hold the encoded value.

Deserializes the value.

Arguments:

  • factory: The current tag factory. It is used to create new inner tags if necessary.
  • value_size: Size of the value in bytes;
  • reader: The tag reader to be used;

Returns:

  • Ok(): On success.
  • Err(()): In case of error.

Returns a reference as Any.

Returns a mutable reference as Any.

Provided methods

Verifies if this tag is implicity.

Verifies if this tag is reserved.

Returns the total size of the tag in bytes.

Serializes this tag.

Arguments:

  • writer: The writer that will receive the encoded value;

Returns:

  • Ok(): On success.
  • Err(()): If the buffer is too small to hold the encoded value.

Implementors