Struct rustlr::generic_absyn::LBox
source · [−]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: usize
column: usize
Implementations
sourceimpl<'t> LBox<dyn Any + 't>
impl<'t> LBox<dyn Any + 't>
sourcepub fn downcast<U: 't>(self) -> Option<LBox<U>>
pub fn downcast<U: 't>(self) -> Option<LBox<U>>
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.
sourcepub fn upcast<T: 't>(lb: LBox<T>) -> Self
pub fn upcast<T: 't>(lb: LBox<T>) -> Self
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
sourceimpl Default for LBox<dyn Any>
impl Default for LBox<dyn Any>
this is provided so LBox<dyn Any>
can be used for the abstract syntax type.
the default is a Lbox containing a static string.
Auto Trait Implementations
impl<T: ?Sized> RefUnwindSafe for LBox<T> where
T: RefUnwindSafe,
impl<T: ?Sized> Send for LBox<T> where
T: Send,
impl<T: ?Sized> Sync for LBox<T> where
T: Sync,
impl<T: ?Sized> Unpin for LBox<T>
impl<T: ?Sized> UnwindSafe for LBox<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more