Trait DynamicContext
trait DynamicContext: Sized
A trait for types that can behave as a dynamic (mutable) URI template expansion context.
This type is for use with UriTemplateStr::expand_dynamic method and its
family.
Note that "dynamic" here does not mean that the value of variables can change during a template expansion. The value should be fixed and consistent during each expansion, but the context is allowed to mutate itself if it does not break this rule.
Exmaples
#
# extern crate alloc;
# use Error;
#
# Ok::
Required Methods
fn visit_dynamic<V: Visitor>(self: &mut Self, visitor: V) -> <V as >::ResultVisits a variable.
To get variable name, use [
Visitor::var_name()].Restriction
The visit results should be consistent and unchanged between the last time [
on_expansion_start]Self::on_expansion_startwas called and the next time [on_expansion_end]Self::on_expansion_endwill be called. If this condition is violated, template expansion will produce wrong result or may panic at worst.
Provided Methods
fn on_expansion_start(self: &mut Self)A callback that is called before the expansion of a URI template.
fn on_expansion_end(self: &mut Self)A callback that is called after the expansion of a URI template.
Implementors
impl<C> DynamicContext for SimpleContextimpl<C: Context> DynamicContext for C