[−][src]Struct quick_xml::events::BytesStart
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
impl<'a> BytesStart<'a>[src]
pub fn borrowed(content: &'a [u8], name_len: usize) -> Self[src]
Creates a new BytesStart from the given content (name + attributes).
Warning
&content[..name_len] is not checked to be a valid name
pub fn borrowed_name(name: &'a [u8]) -> BytesStart<'a>[src]
pub fn owned<C: Into<Vec<u8>>>(
content: C,
name_len: usize
) -> BytesStart<'static>[src]
content: C,
name_len: usize
) -> BytesStart<'static>
Creates a new BytesStart from the given content (name + attributes)
Owns its contents.
pub fn owned_name<C: Into<Vec<u8>>>(name: C) -> BytesStart<'static>[src]
Creates a new BytesStart from the given name
Owns its contents.
pub fn into_owned(self) -> BytesStart<'static>[src]
Converts the event into an owned event.
pub fn to_owned(&self) -> BytesStart<'static>[src]
Converts the event into an owned event without taking ownership of Event
pub fn to_borrowed(&self) -> BytesStart<'_>[src]
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 to_end(&self) -> BytesEnd<'_>[src]
Creates new paired close tag
pub fn with_attributes<'b, I>(self, attributes: I) -> Self where
I: IntoIterator,
I::Item: Into<Attribute<'b>>, [src]
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.
pub fn name(&self) -> &[u8][src]
Gets the undecoded raw tag name as a &[u8].
pub fn local_name(&self) -> &[u8][src]
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.
pub fn unescaped(&self) -> Result<Cow<'_, [u8]>>[src]
Gets the unescaped tag name.
XML escape sequences like "<" will be replaced by their unescaped characters like
"<".
pub fn attributes(&self) -> Attributes<'_>ⓘNotable traits for Attributes<'a>
impl<'a> Iterator for Attributes<'a> type Item = Result<Attribute<'a>>;[src]
Notable traits for Attributes<'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>>;[src]
Notable traits for Attributes<'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 =).
pub fn attributes_raw(&self) -> &[u8][src]
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>>, [src]
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.
pub fn unescape_and_decode<B: BufRead>(
&self,
reader: &Reader<B>
) -> Result<String>[src]
&self,
reader: &Reader<B>
) -> Result<String>
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.
pub fn push_attribute<'b, A: Into<Attribute<'b>>>(&mut self, attr: A)[src]
Adds an attribute to this element.
pub fn set_name(&mut self, name: &[u8]) -> &mut BytesStart<'a>[src]
pub fn clear_attributes(&mut self) -> &mut BytesStart<'a>[src]
Remove all attributes from the ByteStart
Trait Implementations
impl<'a> Clone for BytesStart<'a>[src]
fn clone(&self) -> BytesStart<'a>[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<'a> Debug for BytesStart<'a>[src]
impl<'a> Deref for BytesStart<'a>[src]
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
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,