pub trait ContextWithLocation<'a> {
type Location: Location<'a>;
// Required method
fn context_location(&self) -> &Self::Location;
}Expand description
A context type for quoted snippets (q!(...)) from which a crate::location::Location
can be extracted.
This is implemented both for bare locations (used when splicing quoted values, such as
the argument to crate::location::Location::source_iter) and for OperatorContext
(used when splicing quoted closures passed to operators on live collections). Free
variables that only depend on the location of the splice site (such as
crate::location::cluster::CLUSTER_SELF_ID) are generic over this trait so that they can
be captured in both kinds of quoted snippets.
Required Associated Types§
Required Methods§
Sourcefn context_location(&self) -> &Self::Location
fn context_location(&self) -> &Self::Location
Extracts the location of the splice site from this context.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".