Trait il2_iltags::tags::payload::ILTagPayload[][src]

pub trait ILTagPayload: 'static {
    fn serialized_size(&self) -> usize;
fn serialize(&self, writer: &mut dyn Writer) -> Result<()>;
fn deserialize(
        &mut self,
        factory: &dyn ILTagFactory,
        value_size: usize,
        reader: &mut dyn Reader
    ) -> Result<()>; }
Expand description

This trait must be implemented by all payloads that will be used in conjuction with ILGenericPayloadTag.

Since 1.1.1.

Required methods

Returns the serialized size in bytes. It is equivalent crate::tags::ILTag::value_size().

Serializes this payload. The total lenght of the data written must match the size returned by serialized_size(). It is equivalent to crate::tags::ILTag::serialize_value().

Arguments:

  • writer: The writer;

Returns:

  • Ok(()): In case of success;
  • Err(_): In case of error;

Deserializes the payload and initializes this instace with it. It is equivalent to crate::tags::ILTag::deserialize_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.

Implementors