Skip to main content

FnBody

Enum FnBody 

Source
pub enum FnBody {
    Ast(Vec<Stmt>),
    Compiled(Rc<dyn Any + 'static>),
}
Expand description

Engine-specific representation of a function body.

  • The tree-walker creates Ast bodies and re-walks the AST on every call.
  • The bytecode VM creates Compiled bodies carrying a pre-compiled form (typically Rc<bop_vm::Chunk>). Rc<dyn Any> keeps bop-lang from 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§

§

Ast(Vec<Stmt>)

§

Compiled(Rc<dyn Any + 'static>)

Trait Implementations§

Source§

impl Debug for FnBody

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.