pub trait Visitor: Sized + Sealed {
type Result;
type ListVisitor: ListVisitor<Result = Self::Result>;
type AssocVisitor: AssocVisitor<Result = Self::Result>;
// Required methods
fn var_name(&self) -> VarName<'_>;
fn purpose(&self) -> VisitPurpose;
fn visit_undefined(self) -> Self::Result;
fn visit_string<T: Display>(self, v: T) -> Self::Result;
fn visit_list(self) -> Self::ListVisitor;
fn visit_assoc(self) -> Self::AssocVisitor;
}
Expand description
Variable visitor.
See the module documentation for usage.
Required Associated Types§
sourcetype ListVisitor: ListVisitor<Result = Self::Result>
type ListVisitor: ListVisitor<Result = Self::Result>
List visitor.
sourcetype AssocVisitor: AssocVisitor<Result = Self::Result>
type AssocVisitor: AssocVisitor<Result = Self::Result>
Associative array visitor.
Required Methods§
sourcefn purpose(&self) -> VisitPurpose
fn purpose(&self) -> VisitPurpose
Returns the purpose of the visit.
The template expansion algorithm checks the types for some variables
depending on its usage. To get the usage count correctly, you should
only count visits with VisitPurpose::Expand
.
If you need to know whether the variable is accessed and does not
need dynamic context generation or access counts, consider using
UriTemplateStr::variables
method to iterate the variables in the
URI template.
sourcefn visit_undefined(self) -> Self::Result
fn visit_undefined(self) -> Self::Result
Visits an undefined variable, i.e. indicates that the requested variable is unavailable.
sourcefn visit_string<T: Display>(self, v: T) -> Self::Result
fn visit_string<T: Display>(self, v: T) -> Self::Result
Visits a string variable.
sourcefn visit_list(self) -> Self::ListVisitor
fn visit_list(self) -> Self::ListVisitor
Visits a list variable.
sourcefn visit_assoc(self) -> Self::AssocVisitor
fn visit_assoc(self) -> Self::AssocVisitor
Visits an associative array variable.
Object Safety§
This trait is not object safe.