Struct quick_xml::events::BytesStart [−][src]
pub struct BytesStart<'a> { /* fields omitted */ }Expand description
Opening tag data (Event::Start), with optional attributes.
<name attr="value">.
The name can be accessed using the name, local_name or unescaped methods. An
iterator over the attributes is returned by the attributes method.
Implementations
Creates a new BytesStart from the given content (name + attributes).
Warning
&content[..name_len] is not checked to be a valid name
Creates a new BytesStart from the given content (name + attributes)
Owns its contents.
Creates a new BytesStart from the given name
Owns its contents.
Converts the event into an owned event.
Converts the event into an owned event without taking ownership of Event
Converts the event into a borrowed event. Most useful when paired with to_end.
Example
use quick_xml::events::{BytesStart, Event};
struct SomeStruct<'a> {
attrs: BytesStart<'a>,
// ...
}
writer.write_event(Event::Start(self.attrs.to_borrowed()))?;
// ...
writer.write_event(Event::End(self.attrs.to_end()))?;pub fn with_attributes<'b, I>(self, attributes: I) -> Self where
I: IntoIterator,
I::Item: Into<Attribute<'b>>,
pub fn with_attributes<'b, I>(self, attributes: I) -> Self where
I: IntoIterator,
I::Item: Into<Attribute<'b>>,
Consumes self and yield a new BytesStart with additional attributes from an iterator.
The yielded items must be convertible to Attribute using Into.
Gets the undecoded raw local tag name (excluding namespace) as a &[u8].
All content up to and including the first : character is removed from the tag name.
Gets the unescaped tag name.
XML escape sequences like “<” will be replaced by their unescaped characters like
“<”.
See also unescaped_with_custom_entities()
Gets the unescaped tag name, using custom entities.
XML escape sequences like “<” will be replaced by their unescaped characters like
“<”.
Additional entities can be provided in custom_entities.
Pre-condition
The keys and values of custom_entities, if any, must be valid UTF-8.
See also unescaped()
pub fn attributes(&self) -> Attributes<'_>ⓘNotable traits for Attributes<'a>impl<'a> Iterator for Attributes<'a> type Item = Result<Attribute<'a>>;
pub fn attributes(&self) -> Attributes<'_>ⓘNotable traits for Attributes<'a>impl<'a> Iterator for Attributes<'a> type Item = Result<Attribute<'a>>;
impl<'a> Iterator for Attributes<'a> type Item = Result<Attribute<'a>>;Returns an iterator over the attributes of this tag.
pub fn html_attributes(&self) -> Attributes<'_>ⓘNotable traits for Attributes<'a>impl<'a> Iterator for Attributes<'a> type Item = Result<Attribute<'a>>;
pub fn html_attributes(&self) -> Attributes<'_>ⓘNotable traits for Attributes<'a>impl<'a> Iterator for Attributes<'a> type Item = Result<Attribute<'a>>;
impl<'a> Iterator for Attributes<'a> type Item = Result<Attribute<'a>>;Returns an iterator over the HTML-like attributes of this tag (no mandatory quotes or =).
Gets the undecoded raw string with the attributes of this tag as a &[u8],
including the whitespace after the tag name if there is any.
pub fn extend_attributes<'b, I>(&mut self, attributes: I) -> &mut BytesStart<'a> where
I: IntoIterator,
I::Item: Into<Attribute<'b>>,
pub fn extend_attributes<'b, I>(&mut self, attributes: I) -> &mut BytesStart<'a> where
I: IntoIterator,
I::Item: Into<Attribute<'b>>,
Add additional attributes to this tag using an iterator.
The yielded items must be convertible to Attribute using Into.
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:
unescaped(), as it doesn’t allocate when no escape sequences are used.Reader::decode(), as it only allocates when the decoding can’t be performed otherwise.
Returns the unescaped and decoded string value with custom entities.
This allocates a String in all cases. For performance reasons it might be a better idea to
instead use one of:
unescaped_with_custom_entities(), as it doesn’t allocate when no escape sequences are used.Reader::decode(), as it only allocates when the decoding can’t be performed otherwise.
Pre-condition
The keys and values of custom_entities, if any, must be valid UTF-8.
Adds an attribute to this element.
Remove all attributes from the ByteStart
Trait Implementations
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
Auto Trait Implementations
impl<'a> RefUnwindSafe for BytesStart<'a>
impl<'a> Send for BytesStart<'a>
impl<'a> Sync for BytesStart<'a>
impl<'a> Unpin for BytesStart<'a>
impl<'a> UnwindSafe for BytesStart<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more