pub enum Master<T: Clone> {
Start,
End,
Full(Vec<T>),
}
Expand description
An enum that defines different possible states of a TagDataType::Master
tag.
A “master” tag is a type of tag that contains other tags within it. Because these tags are dynamically sized, the TagIterator
emits these tags as Master::Start
and Master::End
variants by default so that the entire tag does not need to be buffered into memory all at once. The Master::Full
variant is a complete “master” tag that includes all child tags within it.
Variants§
Start
Designates the start of a tag.
End
Designates the end of a tag.
Full(Vec<T>)
Designates a full tag. Vec<T>
contains all child tags contained in this master tag.
Implementations§
source§impl<T: Clone> Master<T>
impl<T: Clone> Master<T>
sourcepub fn get_children(self) -> Vec<T>
pub fn get_children(self) -> Vec<T>
Convenience method to pull children from a master tag.
Panics
Panics if self
is not a Full
variant.
Examples
use ebml_iterable_specification::Master;
let children = vec![EmptySpec::with_data(0x1253, &[1]), EmptySpec::with_data(0x1234, &[2])];
// Clone children because creating a Master consumes it
let tag = Master::Full(children.clone());
let retrieved_children = tag.get_children();
assert_eq!(retrieved_children, children);
Trait Implementations§
source§impl<T: Ord + Clone> Ord for Master<T>
impl<T: Ord + Clone> Ord for Master<T>
source§impl<T: PartialEq + Clone> PartialEq<Master<T>> for Master<T>
impl<T: PartialEq + Clone> PartialEq<Master<T>> for Master<T>
source§impl<T: PartialOrd + Clone> PartialOrd<Master<T>> for Master<T>
impl<T: PartialOrd + Clone> PartialOrd<Master<T>> for Master<T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more