Enum ebml_iterable::specs::Master
source · pub enum Master<T>where
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> Master<T>where
T: Clone,
impl<T> Master<T>where
T: Clone,
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 for Master<T>
impl<T> Ord for Master<T>
source§impl<T> PartialEq for Master<T>
impl<T> PartialEq for Master<T>
source§impl<T> PartialOrd for Master<T>where
T: PartialOrd + Clone,
impl<T> PartialOrd for Master<T>where
T: PartialOrd + 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 moreimpl<T> Eq for Master<T>
impl<T> StructuralPartialEq for Master<T>where
T: Clone,
Auto Trait Implementations§
impl<T> Freeze for Master<T>
impl<T> RefUnwindSafe for Master<T>where
T: RefUnwindSafe,
impl<T> Send for Master<T>where
T: Send,
impl<T> Sync for Master<T>where
T: Sync,
impl<T> Unpin for Master<T>where
T: Unpin,
impl<T> UnwindSafe for Master<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more