Trait ebml_iterable::specs::EbmlSpecification [−][src]
pub trait EbmlSpecification<T> where
T: EbmlSpecification<T>, { fn get_tag(id: u64) -> Option<(T, TagDataType)>; fn get_tag_id(item: &T) -> u64; fn get_tag_data_type(item: &T) -> Option<TagDataType> { ... } }
Expand description
This trait 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][super::TagWriter] needs nothing special, but [TagIterator][super::TagIterator] requires a struct implementing this trait. Custom specification implementations can refer to webm-iterable as an example.
Required methods
Pulls the “type” of tag and the tag data type from the spec based on the tag id.
This function must return None if the input id is not a TagSpecificationDataType in the specification. Implementors can reference webm-iterable for an example.
fn get_tag_id(item: &T) -> u64[src]
fn get_tag_id(item: &T) -> u64[src]Gets the id of a specific tag “type”.
Implementors can reference webm-iterable for an example.
Provided methods
fn get_tag_data_type(item: &T) -> Option<TagDataType>[src]
fn get_tag_data_type(item: &T) -> Option<TagDataType>[src]Gets the type of data that is stored in a specific tag “type”.
The default implementation simply calls get_tag_id followed by get_tag and maps the result as the return value. This function must return None if the input id is not a TagSpecificationDataType in the specification.