Skip to main content

Located

Derive Macro Located 

Source
#[derive(Located)]
Expand description

Procedural macro to derive the Located trait.

To be able to derive Located, a struct must contain a field named span of type Option<Span>.

For enums, only variants with no fields or with a single field are supported at the moment. In the first case, the derived Located implementation returns None, while in the second case the type contained in the variant must in turn be Located, so that its span() method is used.

Example:

ⓘ
#[derive(Located, Locatable)]
struct Identifier {
   name: String,
   span: Option<Span>
}