Struct dae_parser::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

§

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

§

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

§

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.