pub struct Destructure {}Trait Implementations§
Source§impl Clone for Destructure
impl Clone for Destructure
Source§fn clone(&self) -> Destructure
fn clone(&self) -> Destructure
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Destructure
impl Debug for Destructure
Source§impl NegativeWalkMode for Destructure
impl NegativeWalkMode for Destructure
fn needs_pre_match() -> bool
Source§fn qlit_mismatch_error(l: Self::Elt, r: Self::Elt) -> Self::Err
fn qlit_mismatch_error(l: Self::Elt, r: Self::Elt) -> Self::Err
What happens if destructuring fails?
Source§fn pre_match(
expected: Self::Elt,
got: Self::Elt,
env: &Assoc<Name, Self::Elt>,
) -> Option<(Clo<Self::Elt>, Clo<Self::Elt>)>
fn pre_match( expected: Self::Elt, got: Self::Elt, env: &Assoc<Name, Self::Elt>, ) -> Option<(Clo<Self::Elt>, Clo<Self::Elt>)>
Before matching, possibly adjust the two
Elts to match better. (None is auto-match.)
By default, a no-op.Source§fn context_match(
expected: &Ast,
got: &Ast,
_env: Assoc<Name, Self::Elt>,
) -> Result<EnvMBE<Ast>, <Self as WalkMode>::Err>
fn context_match( expected: &Ast, got: &Ast, _env: Assoc<Name, Self::Elt>, ) -> Result<EnvMBE<Ast>, <Self as WalkMode>::Err>
Match the context element against the current node.
Note that this should come after
pre_match,
so any remaining variables will be not be resolved.
TODO: I should think about whether to use Ast or Elt during matches in ast_walk
TODO: This should replace crate::ast::destructure
TODO: Use this moreSource§impl<'t> Reifiable for Destructure
impl<'t> Reifiable for Destructure
Source§fn ty() -> Ast
fn ty() -> Ast
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_tySource§fn ty_name() -> Name
fn ty_name() -> Name
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. WithIntegerfn concrete_arguments() -> Option<Vec<Ast>>
Source§fn ty_invocation() -> Ast
fn ty_invocation() -> Ast
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.Source§impl WalkMode for Destructure
impl WalkMode for Destructure
Source§fn get_walk_rule(f: &Form) -> WalkRule<Destructure>
fn get_walk_rule(f: &Form) -> WalkRule<Destructure>
The whole point of program evaluation is that the enviornment isn’t generateable from the source tree. Does that make sense? I suspect it does not.
Source§type AsPositive = Eval
type AsPositive = Eval
If this walk is positive,
Self; otherwise Self::NegatedSource§type AsNegative = Destructure
type AsNegative = Destructure
If this walk is positive,
Self::Negated; otherwise Selftype Err = ()
type D = Negative<Destructure>
fn name() -> &'static str
Source§fn automatically_extend_env() -> bool
fn automatically_extend_env() -> bool
Should the walker extend the environment based on imports?
Only
QQ and Expand have this as false; it’s not 100% clear what’s special about them.
(This evolved over time; it used to be false for Eval, because of lambda).
It seems like the thing about those modes is
(a) they don’t look at variables, so their environments are irrelevant,
(b) SameAs switching to the negated mode and doing get_res doesn’t work.
But what unites those two factors?Source§fn needs__splice_healing() -> bool
fn needs__splice_healing() -> bool
Do we ever need to treat certain forms as though they were repetitions?
Source§fn perform_splice_positive(
_: &Form,
_: &LazyWalkReses<Self>,
) -> Result<Option<(Vec<Assoc<Name, Self::Elt>>, Ast)>, Self::Err>
fn perform_splice_positive( _: &Form, _: &LazyWalkReses<Self>, ) -> Result<Option<(Vec<Assoc<Name, Self::Elt>>, Ast)>, Self::Err>
A little like
get_walk_rule always returning Custom for positive splicingSource§fn perform_splice_negative(
_: &Form,
_: &LazyWalkReses<Self>,
_context_elts: &dyn Fn() -> Vec<Ast>,
) -> Result<Option<(Vec<Assoc<Name, Self::Elt>>, Ast)>, Self::Err>
fn perform_splice_negative( _: &Form, _: &LazyWalkReses<Self>, _context_elts: &dyn Fn() -> Vec<Ast>, ) -> Result<Option<(Vec<Assoc<Name, Self::Elt>>, Ast)>, Self::Err>
A little like
get_walk_rule always returning Custom for negative splicingSource§fn walk_quasi_literally(
expected: Ast,
cnc: &LazyWalkReses<Self>,
) -> Result<<<Self as WalkMode>::D as Dir>::Out, <Self as WalkMode>::Err>
fn walk_quasi_literally( expected: Ast, cnc: &LazyWalkReses<Self>, ) -> Result<<<Self as WalkMode>::D as Dir>::Out, <Self as WalkMode>::Err>
Walk over the structure of a node, not its meaning.
This could be because we’re inside a syntax-quote,
or it could be that we are a form (like written-out types or a literal)
that acts like a literal.
Children are not necessarily walked quasiliterally
– maybe they’re an interpolation of some kind –
instead, the mode (=quotation depth) and form together decide what to do.
If the walk is negative, the result might be MatchFailure
fn out_as_elt(o: <Self::D as Dir>::Out) -> Self::Elt
fn out_as_env(o: <Self::D as Dir>::Out) -> Assoc<Name, Self::Elt>
fn env_as_out(e: Assoc<Name, Self::Elt>) -> <Self::D as Dir>::Out
fn walk_var( n: Name, cnc: &LazyWalkReses<Self>, ) -> Result<<<Self as WalkMode>::D as Dir>::Out, <Self as WalkMode>::Err>
fn walk_atom( n: Name, cnc: &LazyWalkReses<Self>, ) -> Result<<<Self as WalkMode>::D as Dir>::Out, <Self as WalkMode>::Err>
impl Copy for Destructure
Auto Trait Implementations§
impl Freeze for Destructure
impl RefUnwindSafe for Destructure
impl Send for Destructure
impl Sync for Destructure
impl Unpin for Destructure
impl UnwindSafe for Destructure
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref() only in debug builds, and is erased in release
builds.