Enum ebml_iterable::specs::Master
source · 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, Global>)
Designates a full tag. Vec<T> contains all child tags contained in this master tag.
Implementations§
source§impl<T> Master<T>where
T: Clone,
impl<T> Master<T>where
T: Clone,
sourcepub fn get_children(self) -> Vec<T, Global>
pub fn get_children(self) -> Vec<T, Global>
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 for Master<T>where
T: Ord + Clone,
impl<T> Ord for Master<T>where
T: Ord + Clone,
source§impl<T> PartialEq<Master<T>> for Master<T>where
T: PartialEq<T> + Clone,
impl<T> PartialEq<Master<T>> for Master<T>where
T: PartialEq<T> + Clone,
source§impl<T> PartialOrd<Master<T>> for Master<T>where
T: PartialOrd<T> + Clone,
impl<T> PartialOrd<Master<T>> for Master<T>where
T: PartialOrd<T> + Clone,
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