pub enum AttributeValue<'a> {
Unquoted(UnquotedAttributeValue<'a>),
Quoted(&'a str),
}Expand description
An attribute value within an attribute list.
Values may be quoted or unquoted. In the case that they are unquoted they may be converted into
several other data types. This is done via use of convenience methods on
UnquotedAttributeValue.
Variants§
Unquoted(UnquotedAttributeValue<'a>)
An unquoted value (e.g. TYPE=AUDIO, BANDWIDTH=10000000, SCORE=1.5,
RESOLUTION=1920x1080, SCTE35-OUT=0xABCD, etc.).
Quoted(&'a str)
A quoted value (e.g. CODECS="avc1.64002a,mp4a.40.2").
Implementations§
Source§impl<'a> AttributeValue<'a>
impl<'a> AttributeValue<'a>
Sourcepub fn unquoted(&self) -> Option<UnquotedAttributeValue<'a>>
pub fn unquoted(&self) -> Option<UnquotedAttributeValue<'a>>
A convenience method to get the value of the Unquoted case.
This can be useful when chaining on optional values. For example:
fn get_bandwidth(list: &HashMap<&str, AttributeValue>) -> Option<u64> {
list
.get("BANDWIDTH")
.and_then(AttributeValue::unquoted)
.and_then(|v| v.try_as_decimal_integer().ok())
}Sourcepub fn quoted(&self) -> Option<&'a str>
pub fn quoted(&self) -> Option<&'a str>
A convenience method to get the value of the Quoted case.
This can be useful when chaining on optional values. For example:
fn get_codecs<'a>(list: &HashMap<&'a str, AttributeValue<'a>>) -> Option<&'a str> {
list
.get("CODECS")
.and_then(AttributeValue::quoted)
}Trait Implementations§
Source§impl<'a> Clone for AttributeValue<'a>
impl<'a> Clone for AttributeValue<'a>
Source§fn clone(&self) -> AttributeValue<'a>
fn clone(&self) -> AttributeValue<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for AttributeValue<'a>
impl<'a> Debug for AttributeValue<'a>
Source§impl<'a> PartialEq for AttributeValue<'a>
impl<'a> PartialEq for AttributeValue<'a>
Source§impl<'a> TryFrom<AttributeValue<'a>> for ExtensionAttributeValue<'a>
impl<'a> TryFrom<AttributeValue<'a>> for ExtensionAttributeValue<'a>
impl<'a> Copy for AttributeValue<'a>
impl<'a> StructuralPartialEq for AttributeValue<'a>
Auto Trait Implementations§
impl<'a> Freeze for AttributeValue<'a>
impl<'a> RefUnwindSafe for AttributeValue<'a>
impl<'a> Send for AttributeValue<'a>
impl<'a> Sync for AttributeValue<'a>
impl<'a> Unpin for AttributeValue<'a>
impl<'a> UnsafeUnpin for AttributeValue<'a>
impl<'a> UnwindSafe for AttributeValue<'a>
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