Struct dae_parser::LocalMaps
source · [−]pub struct LocalMaps<'a> { /* private fields */ }
Expand description
A data structure which maintains LocalMap
s for every applicable type.
If you need to use Document::local_map
for many different types,
it may be more efficient to use this type, which calculates all maps
in a single pass.
Implementations
sourceimpl<'a> LocalMaps<'a>
impl<'a> LocalMaps<'a>
sourcepub fn set<T: HasId + 'a>(self) -> Self
pub fn set<T: HasId + 'a>(self) -> Self
Enable collection for the given type. This is used as part of a builder-style API for
customizing collection before performing the collection pass.
For example, if we only want to collect Geometry
and Source
types:
let maps = LocalMaps::default()
.set::<Geometry>()
.set::<Source>()
.collect(&doc);
sourcepub fn unset<T: HasId + 'a>(self) -> Self
pub fn unset<T: HasId + 'a>(self) -> Self
Disable collection for the given type. This is used as part of a builder-style API for
customizing collection before performing the collection pass.
For example, if we want to collect everything except the ForceField
and Sampler
types:
let maps = LocalMaps::new()
.unset::<ForceField>()
.unset::<Sampler>()
.collect(&doc);
sourcepub fn collect(self, t: &'a Document) -> Self
pub fn collect(self, t: &'a Document) -> Self
Run the collection pass, putting all elements in the given IDs based on their types.
sourcepub fn get_name<T: HasId + ?Sized>(&self, n: &NameRef<T>) -> Option<&'a T>
pub fn get_name<T: HasId + ?Sized>(&self, n: &NameRef<T>) -> Option<&'a T>
Look up an element by ID, in a NameRef
.
sourcepub fn get_raw<T: HasId + ?Sized>(&self, url: &Url) -> Option<&'a T>
pub fn get_raw<T: HasId + ?Sized>(&self, url: &Url) -> Option<&'a T>
Look up an element by URL reference.
This is a local map, meaning that it does not support references to URLs which are not
of the special form #ref
, referring to an element with ID ref
in the same document.
sourcepub fn get<T: HasId + ?Sized>(&self, url: &UrlRef<T>) -> Option<&'a T>
pub fn get<T: HasId + ?Sized>(&self, url: &UrlRef<T>) -> Option<&'a T>
Look up an element by URL reference.
This is a simple wrapper around get_raw
,
but it has better type safety, since it ensures that the reference is a reference to a T
.
This is a local map, meaning that it does not support references to URLs which are not
of the special form #ref
, referring to an element with ID ref
in the same document.
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for LocalMaps<'a>
impl<'a> Send for LocalMaps<'a>
impl<'a> Sync for LocalMaps<'a>
impl<'a> Unpin for LocalMaps<'a>
impl<'a> UnwindSafe for LocalMaps<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more