pub struct QueryDesugarTransform;Expand description
Rewrites -> query/dispatch sugar into explicit query()/query_all() calls.
The parser produces BinOp(Query, lhs, rhs) for all -> expressions without
interpreting selector/query semantics. This pass rewrites query/dispatch forms
before the evaluator runs, leaving only plain expr |> fn_value pipes for eval.
§Rewrite rules (implemented)
"selector" -> handler
→ query("selector", handler) // if selector matches #id pattern
→ query_all("selector", handler) // otherwise§Deferred (pending Query HostCall + small extra rewrite rules)
"selector" -> method(args)
→ query("selector", fn(r) { r.method(args) })
scope -> "selector" -> handler
→ scope.query("selector", handler)These do not need a dedicated Expression::MethodCall AST node — methods
are already represented as CallExpression with callee = BinOp(Dot, ..).
They need: (1) a Query HostCall on the host, (2) detection of Call-shaped
rhs in the existing BinOp(Query, ..) rewrite. See
docs/meow_meow/task/query-engine-and-mms-query-host-calls.md.
Selector heuristic: starts with # and contains no spaces or combinators → single
(query); otherwise → multiple (query_all). Callers can override with the explicit
query()/query_all() function forms.
Implementations§
Auto Trait Implementations§
impl Freeze for QueryDesugarTransform
impl RefUnwindSafe for QueryDesugarTransform
impl Send for QueryDesugarTransform
impl Sync for QueryDesugarTransform
impl Unpin for QueryDesugarTransform
impl UnsafeUnpin for QueryDesugarTransform
impl UnwindSafe for QueryDesugarTransform
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.