pub struct BytesAttr<'src> {
pub name: &'src [u8],
pub value: Cow<'src, [u8]>,
}Expand description
A single attribute from a start tag, with a zero-copy value when possible.
The name is always borrowed directly from the source — XML name
chars can’t include entity refs, so no allocation is ever needed.
The value is Cow::Borrowed for the common case (no entity
references in the literal) and Cow::Owned only when the value
contained &entity; references that the parser had to expand.
Fields§
§name: &'src [u8]Source-borrowed attribute name (e.g. b"id", b"xmlns:foo").
value: Cow<'src, [u8]>Attribute value. Borrowed from source when no entity expansion happened; owned otherwise.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<'src> Freeze for BytesAttr<'src>
impl<'src> RefUnwindSafe for BytesAttr<'src>
impl<'src> Send for BytesAttr<'src>
impl<'src> Sync for BytesAttr<'src>
impl<'src> Unpin for BytesAttr<'src>
impl<'src> UnsafeUnpin for BytesAttr<'src>
impl<'src> UnwindSafe for BytesAttr<'src>
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