pub enum FnBody {
Ast(Vec<Stmt>),
Compiled(Rc<dyn Any + 'static>),
}Expand description
Engine-specific representation of a function body.
- The tree-walker creates
Astbodies and re-walks the AST on every call. - The bytecode VM creates
Compiledbodies carrying a pre-compiled form (typicallyRc<bop_vm::Chunk>).Rc<dyn Any>keepsbop-langfrom taking a dep on any particular engine crate.
An engine that only understands one variant errors cleanly when handed the other, rather than silently misbehaving.
Variants§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FnBody
impl !RefUnwindSafe for FnBody
impl !Send for FnBody
impl !Sync for FnBody
impl Unpin for FnBody
impl UnsafeUnpin for FnBody
impl !UnwindSafe for FnBody
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more