pub struct Template { /* private fields */ }Expand description
A parsed template.
Implementations§
Source§impl Template
impl Template
Sourcepub fn parse(source: &str) -> Result<Self, TemplateError>
pub fn parse(source: &str) -> Result<Self, TemplateError>
Parse source.
§Errors
When it does not start with /, has an empty segment, a query or
fragment, an expression that is not the end of its segment, one that
is not a plain name, or two expressions of one name.
Sourcepub fn expand(&self, values: &Values) -> Result<String, TemplateError>
pub fn expand(&self, values: &Values) -> Result<String, TemplateError>
The path with each expression replaced by its value, encoded.
§Errors
When a value is missing or empty.
Sourcepub fn matches(&self, path: &str) -> Option<Values>
pub fn matches(&self, path: &str) -> Option<Values>
The values of path, if it matches. path has no query.
Sourcepub fn specificity(&self, other: &Self) -> Ordering
pub fn specificity(&self, other: &Self) -> Ordering
How specific self is next to other, for a path that matches
both: at the first segment where they differ, a literal is more
specific than an expression, and an expression with a longer prefix
than one with a shorter. Equal when no segment tells them apart, so
that neither can be preferred.
Trait Implementations§
impl Eq for Template
impl StructuralPartialEq for Template
Auto Trait Implementations§
impl Freeze for Template
impl RefUnwindSafe for Template
impl Send for Template
impl Sync for Template
impl Unpin for Template
impl UnsafeUnpin for Template
impl UnwindSafe for Template
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.