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
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.
Source§impl Document
impl Document
Sourcepub fn library_iter<T>(&self) -> LibraryIter<'_, T> ⓘ
pub fn library_iter<T>(&self) -> LibraryIter<'_, T> ⓘ
Returns an iterator over Library<T>
elements.
Source§impl 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
.