Struct libunseemly::ast_walk::LazyWalkReses[][src]

pub struct LazyWalkReses<Mode: WalkMode> {
    pub parts: EnvMBE<Rc<LazilyWalkedTerm<Mode>>>,
    pub env: ResEnv<Mode::Elt>,
    pub prelude_env: ResEnv<Mode::Elt>,
    pub more_quoted_env: Vec<ResEnv<Mode::Elt>>,
    pub less_quoted_env: Vec<ResEnv<Mode::Elt>>,
    pub less_quoted_out_env: Vec<Option<OutEnvHandle<Mode>>>,
    pub this_ast: Ast,
    pub extra_info: Mode::ExtraInfo,
}
Expand description

Package containing enough information to walk the subforms of some form on-demand.

It is safe to have unwalkable subforms, as long as nothing ever refers to them.

Contents probably shouldn’t be pub

Fields

parts: EnvMBE<Rc<LazilyWalkedTerm<Mode>>>

Things that we have walked and that we might walk

env: ResEnv<Mode::Elt>

The environment of the overall walk.

prelude_env: ResEnv<Mode::Elt>

The environment to use when entering a new phase. It’s like a prelude, except that it’s affected by syntax extensions.

more_quoted_env: Vec<ResEnv<Mode::Elt>>

The environment for syntax quotation (deeper on the front, shallower on the back)

less_quoted_env: Vec<ResEnv<Mode::Elt>>

The environment for interpolation (further out on the front, nearer on the back)

less_quoted_out_env: Vec<Option<OutEnvHandle<Mode>>>

For all the less-quoted walks ongoing whose direction is negative, we need to smuggle out results. This is a stack of (optional, because not all walks are negative) mutable handles to the environments being accumulated.

this_ast: Astextra_info: Mode::ExtraInfo

Implementations

Slight hack: this is just to get a recursion started with some environment. Only use this in tests or at the top level; this discards any non-phase-0-environments!

The result of walking the subform named part_name. This is memoized.

Will get_res or get_term panic? Rarely used, because a form typically knows which named subterms it has based on parsing.

Like get_res, but for subforms that are repeated at depth 1. Sort of a hack.

Like get_res, but with depth levels of repetition, and calling f to flatten the result

Like flatten_res_at_depth, but uses leaf instead of doing get_res TODO: this is used in only one place, and feels really awkward.

Like get_term, but with depth levels of repetition, and calling m to map and f to flatten the result

The subform named part_name, without any processing.

Only needed if, for some reason, a form could occur with or without a particular term. (a hack involving “mu_type” and “opacity_for_different_phase” does this)

Only sensible for negative walks

Change the context (by editing the environment). Only sensible for negative walks. Don’t do .with_context(…).with_environment(…); it’s the same as .with_environment(…).

Change the whole environment

Change the prelude environment

Clear the memo table; important if you’re re-evaluating the same term, but have changed the environment

Switch to a different mode with the same Elt type.

If Mode is positive, returns self. If Mode is negative, switch_modes it to be positive

If Mode is negative, returns self. If Mode is positive, switch_modes it to be negative

Shift to a less-quoted level. If the OEH is non-None, you need to call squirrel_away.

March by example, turning a repeated set of part names into one LWR per repetition. Keeps the same environment.

HACK: The mbe_one_name! macro expects a type with march_all (it can accept both LazyWalkReses and EnvMBE). But, for LazyWalkReses, prefer march_parts, so don’t use this ) :

Combines march_parts and with_context. new_contexts should have the same length as the repetition marched.

Like get_rep_res, but with a different context for each repetition

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

A name for that type, so that recursive types are okay. Ignore the type parameters of Self; invoke like Self::<Irr,Irr>::ty_name(). e.g. WithInteger Read more

The Unseemly value that corresponds to a value.

Get a value from an Unseemly value

The Unseemly type that corresponds to to the Reifiable type. This leaves abstract the type parameters of Self; invoke like Self::<Irr,Irr>::ty(). e.g. ∀ A. Pair<A int> TODO: rename to generic_ty Read more

How to refer to this type, given an environment in which ty_name() is defined to be ty(). Parameters will be concrete. e.g. WithInteger<Float> (Types using this type will use this, rather than ty) Don’t override this. Read more

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

Converts self into T using Into<T>. Read more

Performs the conversion.

Performs the conversion.

Pipes by value. This is generally the method you want to use. Read more

Borrows self and passes that borrow into the pipe function. Read more

Mutably borrows self and passes that borrow into the pipe function. Read more

Borrows self, then passes self.borrow() into the pipe function. Read more

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more

Borrows self, then passes self.as_ref() into the pipe function.

Mutably borrows self, then passes self.as_mut() into the pipe function. Read more

Borrows self, then passes self.deref() into the pipe function.

Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more

Should always be Self

Immutable access to a value. Read more

Mutable access to a value. Read more

Immutable access to the Borrow<B> of a value. Read more

Mutable access to the BorrowMut<B> of a value. Read more

Immutable access to the AsRef<R> view of a value. Read more

Mutable access to the AsMut<R> view of a value. Read more

Immutable access to the Deref::Target of a value. Read more

Mutable access to the Deref::Target of a value. Read more

Calls .tap() only in debug builds, and is erased in release builds.

Calls .tap_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more

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

Attempts to convert self into T using TryInto<T>. 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.