pub struct LBox<T: ?Sized> {
    pub exp: Box<T>,
    pub line: usize,
    pub column: usize,
}
Expand description

custom smart pointer that encapsulates line number and column. Source ID information is kept at the parser (RuntimeParser or ZCParser) level (since version 0.2.0). For warnings and error messages after the parsing stage. Implements Deref and DerefMut so the encapsulated expression can be accessed as in a standard Box.

Fields

exp: Box<T>line: usizecolumn: usize

Implementations

should be used to create a new LBoxed expression that inherits lexical information from existing LBox

emulates Box::downcast function, when LBox<dyn Any> is used as the abstract syntax type. Note that unlike Box::downcast, an Option is returned here instead of a result.

do not try to create a LBox<dyn Any> structure with something like

 let lb:LBox<dyn Any> = LBox::new(String::from("abc"),0,0);

This does not work as LBox is simply borrowing the underlying mechanics of Box instead of re-creating them. Do instead:

 let lb:LBox<dyn Any> = LBox::upcast(LBox::new(String::from("abc"),0,0));

upcast always returns a LBox<dyn Any>.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

this is provided so LBox<dyn Any> can be used for the abstract syntax type. the default is a Lbox containing a static string.

Returns the “default value” for a type. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.