Skip to main content

Locatable

Trait Locatable 

Source
pub trait Locatable: Sized {
    type Located: Located;

    // Required method
    fn over(self, span: impl Into<Option<Span>>) -> Self::Located;
}
Expand description

Add or set a Span to a type.

Locatable is for Located types that support changing their tracked Span, or for types that can be turned into Located types. The Locatable::over method is a builder method used to create a new object with a different Span, and the Located associated type tell the type of the result.

Example:

let term = term!(* x y).over(span);

Locatable can be automatically derived (see the corresponding proc-macro for details).

Required Associated Types§

Required Methods§

Source

fn over(self, span: impl Into<Option<Span>>) -> Self::Located

Turns self into an object of type Self::Located tracking the new span.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Locatable for Option<Span>

Source§

type Located = Option<Span>

Source§

fn over(self, span: impl Into<Option<Span>>) -> Self::Located

Implementors§