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 name.

Warning

&content 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()))?;

Creates new paired close tag

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 tag name as a &[u8].

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 “&lt;” 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 “&lt;” 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()

Returns an iterator over the attributes of this tag.

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.

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:

Pre-condition

The keys and values of custom_entities, if any, must be valid UTF-8.

Adds an attribute to this element.

Edit the name of the BytesStart in-place

Warning

name is not checked to be a valid name

Remove all attributes from the ByteStart

Try to get an attribute

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.