pub struct Attribute<'data> { /* private fields */ }
Expand description
Represent a XML attribute.
Implementations§
Source§impl<'data> Attribute<'data>
impl<'data> Attribute<'data>
Sourcepub fn new(
key: &'data (impl AsRef<[u8]> + ?Sized),
value: impl Into<Cow<'data, [u8]>>,
) -> Self
pub fn new( key: &'data (impl AsRef<[u8]> + ?Sized), value: impl Into<Cow<'data, [u8]>>, ) -> Self
Returns a new Attribute
.
Sourcepub fn value(&self) -> Result<Cow<'_, str>, Error>
pub fn value(&self) -> Result<Cow<'_, str>, Error>
Returns the value.
§Errors
Will return Err
if:
- The value is invalid UTF-8
- Unescaping the value fails
Sourcepub fn value_bytes(&self) -> &[u8] ⓘ
pub fn value_bytes(&self) -> &[u8] ⓘ
Returns the value as bytes. They may or may not be escaped.
Trait Implementations§
impl<'data> StructuralPartialEq for Attribute<'data>
Auto Trait Implementations§
impl<'data> Freeze for Attribute<'data>
impl<'data> RefUnwindSafe for Attribute<'data>
impl<'data> Send for Attribute<'data>
impl<'data> Sync for Attribute<'data>
impl<'data> Unpin for Attribute<'data>
impl<'data> UnwindSafe for Attribute<'data>
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