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
sourceimpl Document
impl Document
sourcepub fn try_for_each<'a, T: Traversable + ?Sized + 'a, E, F: FnMut(&'a T) -> Result<(), E>>(
&'a self,
f: F
) -> Result<(), E>
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.
sourcepub fn for_each<'a, T: Traversable + ?Sized + 'a>(&'a self, f: impl FnMut(&'a T))
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.
sourcepub fn local_map<T: Traversable + HasId + ?Sized>(
&self
) -> Result<LocalMap<'_, T>, Error>
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.
sourcepub fn get_visual_scene(&self) -> Option<&VisualScene>
pub fn get_visual_scene(&self) -> Option<&VisualScene>
Convenience function, to return the main VisualScene
referred to in the scene
field.
sourcepub fn local_maps(&self) -> LocalMaps<'_>
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.
sourceimpl Document
impl Document
sourcepub fn library_iter<T>(&self) -> LibraryIter<'_, T>ⓘNotable traits for LibraryIter<'a, T>impl<'a, T: ParseLibrary + 'a> Iterator for LibraryIter<'a, T> type Item = &'a Library<T>;
pub fn library_iter<T>(&self) -> LibraryIter<'_, T>ⓘNotable traits for LibraryIter<'a, T>impl<'a, T: ParseLibrary + 'a> Iterator for LibraryIter<'a, T> type Item = &'a Library<T>;
Returns an iterator over Library<T>
elements.
sourceimpl Document
impl Document
sourcepub fn create_now() -> Self
pub fn create_now() -> Self
Constructs a new empty Document
with creation date set to the current date/time.
sourcepub fn push_library<T: ParseLibrary>(&mut self, items: Vec<T>)
pub fn push_library<T: ParseLibrary>(&mut self, items: Vec<T>)
Add a new library element with the given items.
sourcepub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, Error>
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, Error>
Constructs a Document
from a file.
sourcepub fn from_reader<R: BufRead>(reader: R) -> Result<Self, Error>
pub fn from_reader<R: BufRead>(reader: R) -> Result<Self, Error>
sourcepub fn from_xml_reader<R: BufRead>(
reader: &mut Reader<R>
) -> Result<Self, Error>
pub fn from_xml_reader<R: BufRead>(
reader: &mut Reader<R>
) -> Result<Self, Error>
Constructs a Document
from a
quick_xml::Reader
.