pub struct LocalMap<'a, T: ?Sized>(pub HashMap<&'a str, &'a T>);
Expand description
A map for looking up elements of type T
in the document by ID.
Tuple Fields§
§0: HashMap<&'a str, &'a T>
Implementations§
Source§impl<'a, T: ?Sized> LocalMap<'a, T>
impl<'a, T: ?Sized> LocalMap<'a, T>
Sourcepub fn get_name(&self, n: &NameRef<T>) -> Option<&'a T>
pub fn get_name(&self, n: &NameRef<T>) -> Option<&'a T>
Look up an element by ID, in a NameRef
.
Sourcepub fn get_raw(&self, url: &Url) -> Option<&'a T>
pub fn get_raw(&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(&self, url: &UrlRef<T>) -> Option<&'a T>
pub fn get(&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, T> Freeze for LocalMap<'a, T>where
T: ?Sized,
impl<'a, T> RefUnwindSafe for LocalMap<'a, T>where
T: RefUnwindSafe + ?Sized,
impl<'a, T> Send for LocalMap<'a, T>
impl<'a, T> Sync for LocalMap<'a, T>
impl<'a, T> Unpin for LocalMap<'a, T>where
T: ?Sized,
impl<'a, T> UnwindSafe for LocalMap<'a, T>where
T: RefUnwindSafe + ?Sized,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more