Skip to main content

ContextWithLocation

Trait ContextWithLocation 

Source
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§

Source

type Location: Location<'a>

The location type of this context.

Required Methods§

Source

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".

Implementors§

Source§

impl<'a, L: Location<'a>, B> ContextWithLocation<'a> for OperatorContext<L, B>

Source§

impl<'a, L: Location<'a>> ContextWithLocation<'a> for L