Interp

Struct Interp 

Source
pub struct Interp<'a> {
    pub steps: u64,
    pub exhausted: bool,
    /* private fields */
}

Fields§

§steps: u64

What is left of MAX_STEPS for the whole module.

§exhausted: bool

Whether the budget ran out, so the diagnostic is reported once rather than at every macro that would have run afterwards.

Implementations§

Source§

impl<'a> Interp<'a>

Source

pub fn new( defs: &'a HashMap<Arc<str>, FnDef>, diags: &'a mut Diagnostics, steps: u64, exhausted: bool, ) -> Interp<'a>

Source

pub fn called_at(self, span: Span) -> Interp<'a>

Where the call being expanded was written.

Source

pub fn knowing(self, types: Option<&'a TypeEnv>) -> Interp<'a>

The same, with the checker’s answers about the call site in reach.

Source

pub fn run_body( &mut self, name: &str, body: &Node, env: HashMap<Arc<str>, Val>, def_span: Span, ) -> Option<Node>

Run a macro body, given its parameters already bound to the syntax they were called with.

The result is whatever the body returned, reflected into syntax — so return quote: … is a template and return 6 * 7 is the literal 42.

Source

pub fn reflect(&mut self, v: &Val, span: Span) -> Result<Node, Halt>

A value’s syntax.

Every value has one except a function: a closure is a thing the compile-time environment holds, and there is no expression that denotes it in the program being built.

Auto Trait Implementations§

§

impl<'a> Freeze for Interp<'a>

§

impl<'a> RefUnwindSafe for Interp<'a>

§

impl<'a> Send for Interp<'a>

§

impl<'a> Sync for Interp<'a>

§

impl<'a> Unpin for Interp<'a>

§

impl<'a> !UnwindSafe for Interp<'a>

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.