A struct representing a key/value XML attribute.
Field value stores raw bytes, possibly containing escape-sequences. Most users will likely
want to access the value using one of the unescaped_value and unescape_and_decode_value
functions.
The raw value of the attribute.
Returns the unescaped value.
This is normally the value you are interested in. Escape sequences such as > are
replaced with their unescaped equivalents such as >.
This will allocate if the value contains any escape sequences.
Returns the unescaped and decoded string value.
This allocates a String in all cases. For performance reasons it might be a better idea to
instead use one of:
Creates new attribute from raw bytes.
Does not apply any transformation to both key and value.
use quick_xml::events::attributes::Attribute;
let features = Attribute::from(("features".as_bytes(), "Bells & whistles".as_bytes()));
assert_eq!(features.value, "Bells & whistles".as_bytes());
Creates new attribute from text representation.
Key is stored as-is, but the value will be escaped.
use quick_xml::events::attributes::Attribute;
let features = Attribute::from(("features", "Bells & whistles"));
assert_eq!(features.value, "Bells & whistles".as_bytes());
Performs copy-assignment from source. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=.
Formats the value using the given formatter. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id)
this method will likely be replaced by an associated static
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from)