Trait webm_iterable::matroska_spec::EbmlTag [−]
pub trait EbmlTag<T> where
T: Clone, { fn get_id(&self) -> u64; fn as_unsigned_int(&self) -> Option<&u64>; fn as_signed_int(&self) -> Option<&i64>; fn as_utf8(&self) -> Option<&str>; fn as_binary(&self) -> Option<&[u8]>; fn as_float(&self) -> Option<&f64>; fn as_master(&self) -> Option<&Master<T>>; }
Expand description
This trait, along with EbmlSpecification
, should be implemented to define a specification so that EBML can be parsed correctly. Typically implemented on an Enum of tag variants.
Any specification using EBML can take advantage of this library to parse or write binary data. As stated in the docs, TagWriter
needs nothing special if you stick with the write_raw
method, but TagIterator
requires a struct implementing this trait. Custom specification implementations can refer to webm-iterable as an example.
This trait and EbmlSpecification
are typically implemented simultaneously. They are separate traits as they have primarily different uses - EbmlSpecification
should be brought into scope when dealing with the specification as a whole, whereas EbmlTag
should be brought into scope when dealing with specific tags.
Required methods
Gets the id of self
.
Implementors can reference webm-iterable for an example.
fn as_unsigned_int(&self) -> Option<&u64>
fn as_unsigned_int(&self) -> Option<&u64>
Gets a reference to the data contained in self
as an unsigned integer.
This function must return None
if the associated data type of self
is not TagDataType::UnsignedInt
. Implementors can reference webm-iterable for an example.
fn as_signed_int(&self) -> Option<&i64>
fn as_signed_int(&self) -> Option<&i64>
Gets a reference to the data contained in self
as an integer.
This function must return None
if the associated data type of self
is not TagDataType::Integer
. Implementors can reference webm-iterable for an example.
Gets a reference to the data contained in self
as string slice.
This function must return None
if the associated data type of self
is not TagDataType::Utf8
. Implementors can reference webm-iterable for an example.
Gets a reference to the data contained in self
as binary data.
This function must return None
if the associated data type of self
is not TagDataType::Binary
. Implementors can reference webm-iterable for an example.
Gets a reference to the data contained in self
as float data.
This function must return None
if the associated data type of self
is not TagDataType::Float
. Implementors can reference webm-iterable for an example.
Gets a reference to master data contained in self
.
This function must return None
if the associated data type of self
is not TagDataType::Master
. Implementors can reference webm-iterable for an example.
Implementations on Foreign Types
impl EbmlTag<EmptySpec> for EmptySpec
impl EbmlTag<EmptySpec> for EmptySpec