Struct exile::Document[][src]

pub struct Document { /* fields omitted */ }
Expand description

Represents an XML Document.

Implementations

impl<'a> Document[src]

pub fn new() -> Document[src]

Create a new default document.

impl Document[src]

pub fn from_root(root: Element) -> Self[src]

Construct a new Document using the given Element as the root.

pub fn root(&self) -> &Element[src]

Get the root Element.

pub fn set_root(&mut self, element_data: Element)[src]

Set the root Element.

pub fn root_mut(&mut self) -> &mut Element[src]

Get a mutable reference to the root Element.

pub fn declaration(&self) -> &Declaration[src]

Get the Declaration object.

pub fn set_declaration(&mut self, declaration: Declaration)[src]

Set the Declaration object for the Document.

pub fn set_doctype<S: Into<String>>(&mut self, _: S) -> Result<(), XDocErr>[src]

Disabled doctype setter.

pub fn add_prolog_comment<S: Into<String>>(
    &mut self,
    comment: S
) -> Result<(), XDocErr>
[src]

Add a comment before the document root element.

pub fn add_prolog_pi(&mut self, pi: Pi)[src]

Add a processing instruction before the document root element.

pub fn clear_prolog_misc(&mut self)[src]

Remove all [PI] and comment entries before the root element.

pub fn prolog_misc(&self) -> impl Iterator<Item = &Misc> + '_[src]

Access the Misc entries before the root element.

pub fn add_epilog_comment<S: Into<String>>(
    &mut self,
    comment: S
) -> Result<(), XDocErr>
[src]

Add a comment after the document root element.

pub fn add_epilog_pi(&mut self, pi: Pi)[src]

Add a processing instruction after the document root element.

pub fn clear_epilog_misc(&mut self)[src]

Clear all Misc entries after the root element.

pub fn epilog_misc(&self) -> Iter<'_, Misc>[src]

Access the Misc entries after the root element.

pub fn write<W>(&self, writer: &mut W) -> Result<()> where
    W: Write
[src]

Write the Document to the Write object.

pub fn write_opts<W>(
    &self,
    writer: &mut W,
    opts: &WriteOpts
) -> Result<(), XDocErr> where
    W: Write
[src]

Write the Document to the Write object using the given options.

pub fn to_string_opts(&self, opts: &WriteOpts) -> Result<String, XDocErr>[src]

Write the Document to a String using the given options.

pub fn save<P: AsRef<Path>>(&self, path: P) -> Result<()>[src]

Save a document to a file.

pub fn index(self) -> Index[src]

Create an index of the elements in this document. Takes ownership of document.

Trait Implementations

impl Clone for Document[src]

fn clone(&self) -> Document[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Document[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for Document[src]

fn default() -> Document[src]

Returns the “default value” for a type. Read more

impl Hash for Document[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl PartialEq<Document> for Document[src]

fn eq(&self, other: &Document) -> bool[src]

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

fn ne(&self, other: &Document) -> bool[src]

This method tests for !=.

impl PartialOrd<Document> for Document[src]

fn partial_cmp(&self, other: &Document) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl ToString for Document[src]

fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl Eq for Document[src]

impl StructuralEq for Document[src]

impl StructuralPartialEq for Document[src]

impl Unpin for Document[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.