Struct Document

Source
pub struct Document {
    pub asset: Asset,
    pub library: Vec<LibraryElement>,
    pub scene: Option<Scene>,
    pub extra: Vec<Extra>,
}
Expand description

A Collada document. Represents the <COLLADA> root node.

This is the main entry point for parsing.

Fields§

§asset: Asset

Metadata about the origin of the document

§library: Vec<LibraryElement>

The main content, organized into a list of “libraries”.

§scene: Option<Scene>

The actual scene being described, which references / instantiates objects in the libraries.

§extra: Vec<Extra>

Provides arbitrary additional information about this element.

Implementations§

Source§

impl Document

Source

pub fn try_for_each<'a, T: Traversable + ?Sized + 'a, E, F: FnMut(&'a T) -> Result<(), E>>( &'a self, f: F, ) -> Result<(), E>

Run a function over all elements of type T in the document.

Source

pub fn for_each<'a, T: Traversable + ?Sized + 'a>( &'a self, f: impl FnMut(&'a T), )

Run a function over all elements of type T in the document.

Source

pub fn local_map<T: Traversable + HasId + ?Sized>( &self, ) -> Result<LocalMap<'_, T>, Error>

Construct an ID -> element mapping for node type T. This can be used to look up ID references.

Source

pub fn get_visual_scene(&self) -> Option<&VisualScene>

Convenience function, to return the main VisualScene referred to in the scene field.

Source

pub fn local_maps(&self) -> LocalMaps<'_>

Construct an ID -> element mapping for every node type T. This can be used to look up ID references.

This function will initialize every type. See LocalMaps::default and LocalMaps::set for a builder API which allows you to pick which types you are interested in, or LocalMaps::new and LocalMaps::unset to exclude certain types.

Source§

impl Document

Source

pub fn library_iter<T>(&self) -> LibraryIter<'_, T>

Returns an iterator over Library<T> elements.

Source

pub fn iter<T>(&self) -> ItemIter<'_, T>

Returns an iterator over all elements of type T.

Source§

impl Document

Source

pub fn new(asset: Asset) -> Self

Constructs a new empty Document.

Source

pub fn create_now() -> Self

Constructs a new empty Document with creation date set to the current date/time.

Source

pub fn push_library<T: ParseLibrary>(&mut self, items: Vec<T>)

Add a new library element with the given items.

Source

pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, Error>

Constructs a Document from a file.

Source

pub fn from_reader<R: BufRead>(reader: R) -> Result<Self, Error>

Constructs a Document from any BufRead reader. Use BufReader to construct a BufRead if you only have a Read instance.

Source

pub fn from_xml_reader<R: BufRead>( reader: &mut Reader<R>, ) -> Result<Self, Error>

Constructs a Document from a quick_xml::Reader.

Source

pub fn write_to<W: Write>(&self, w: W) -> Result<(), Error>

Write the document to a writer.

Trait Implementations§

Source§

impl Clone for Document

Source§

fn clone(&self) -> Document

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Document

Source§

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

Formats the value using the given formatter. Read more
Source§

impl FromStr for Document

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Error>

Parses a string s to return a value of this type. Read more
Source§

impl TryFrom<&[u8]> for Document

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(s: &[u8]) -> Result<Self, Error>

Performs the conversion.
Source§

impl TryFrom<&str> for Document

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(s: &str) -> Result<Self, Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.