pub struct Attributes<'a>(/* private fields */);Expand description
The attributes of an expression or markup, in source order; a None
value is the spec’s true (an attribute written without a value).
Implementations§
Source§impl<'a> Attributes<'a>
impl<'a> Attributes<'a>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
No attributes, with room for capacity without reallocating.
Sourcepub fn push(&mut self, name: Cow<'a, str>, value: Option<Literal<'a>>)
pub fn push(&mut self, name: Cow<'a, str>, value: Option<Literal<'a>>)
Appends an attribute (duplicates are kept).
Sourcepub fn iter(&self) -> impl Iterator<Item = (&str, Option<&Literal<'a>>)>
pub fn iter(&self) -> impl Iterator<Item = (&str, Option<&Literal<'a>>)>
(identifier, value) pairs, in source order.
Sourcepub fn get(&self, name: &str) -> Option<Option<&Literal<'a>>>
pub fn get(&self, name: &str) -> Option<Option<&Literal<'a>>>
The value of the last attribute named exactly name — all but the
last are ignored (syntax.md, “Attributes”): None if there is
none, Some(None) if it has no value.
Sourcepub fn into_owned(self) -> Attributes<'static>
pub fn into_owned(self) -> Attributes<'static>
The same attributes, owned.
Trait Implementations§
Source§impl<'a> Clone for Attributes<'a>
impl<'a> Clone for Attributes<'a>
Source§impl<'a> Debug for Attributes<'a>
impl<'a> Debug for Attributes<'a>
Source§impl<'a> Default for Attributes<'a>
impl<'a> Default for Attributes<'a>
impl<'a> Eq for Attributes<'a>
Source§impl<'a> FromIterator<(Cow<'a, str>, Option<Literal<'a>>)> for Attributes<'a>
impl<'a> FromIterator<(Cow<'a, str>, Option<Literal<'a>>)> for Attributes<'a>
Source§impl<'a> Hash for Attributes<'a>
impl<'a> Hash for Attributes<'a>
Source§impl<'a> PartialEq for Attributes<'a>
impl<'a> PartialEq for Attributes<'a>
Source§impl Serialize for Attributes<'_>
Available on crate feature serde only.
impl Serialize for Attributes<'_>
Available on crate feature
serde only.Source§fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>
fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>
A repeated name writes only its last occurrence: the syntax allows
the repeat (unique names are only a SHOULD) and only the last of a
repeated attribute counts (syntax.md, “Attributes”), while a JSON object holds a name once. The model keeps
every occurrence, as written.
impl<'a> StructuralPartialEq for Attributes<'a>
Auto Trait Implementations§
impl<'a> Freeze for Attributes<'a>
impl<'a> RefUnwindSafe for Attributes<'a>
impl<'a> Send for Attributes<'a>
impl<'a> Sync for Attributes<'a>
impl<'a> Unpin for Attributes<'a>
impl<'a> UnsafeUnpin for Attributes<'a>
impl<'a> UnwindSafe for Attributes<'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