Skip to main content

Locatable

Derive Macro Locatable 

Source
#[derive(Locatable)]
Expand description

Procedural macro to derive the Locatable trait.

To be able to derive Locatable, 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 Locatable returns the same variant as is, while in the second case the type contained in the variant must in turn be Locatable, so that its over() method is used.

Example:

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