Added support for defining macros in Rust within the macro system

Also fixed a lot of bugs
This commit is contained in:
2025-09-30 21:23:16 +02:00
parent 7971a2b4eb
commit b77653f841
52 changed files with 849 additions and 502 deletions

View File

@@ -109,8 +109,8 @@ impl ForeignAtom {
.await?;
Some(M::Response::decode(Pin::new(&mut &rep[..])).await)
}
pub async fn downcast<T: AtomicFeatures>(self) -> Result<TypAtom<T>, NotTypAtom> {
TypAtom::downcast(self.ex().handle()).await
pub async fn downcast<T: AtomicFeatures>(self) -> Result<TAtom<T>, NotTypAtom> {
TAtom::downcast(self.ex().handle()).await
}
}
impl fmt::Display for ForeignAtom {
@@ -222,11 +222,12 @@ impl<A: AtomCard> Default for MethodSetBuilder<A> {
}
#[derive(Clone)]
pub struct TypAtom<A: AtomicFeatures> {
pub struct TAtom<A: AtomicFeatures> {
pub untyped: ForeignAtom,
pub value: A::Data,
}
impl<A: AtomicFeatures> TypAtom<A> {
impl<A: AtomicFeatures> TAtom<A> {
pub fn ex(&self) -> Expr { self.untyped.clone().ex() }
pub fn ctx(&self) -> &SysCtx { self.untyped.ctx() }
pub fn i(&self) -> &Interner { self.ctx().i() }
pub async fn downcast(expr: Rc<ExprHandle>) -> Result<Self, NotTypAtom> {
@@ -262,11 +263,11 @@ impl<A: AtomicFeatures> TypAtom<A> {
.await
}
}
impl<A: AtomicFeatures> Deref for TypAtom<A> {
impl<A: AtomicFeatures> Deref for TAtom<A> {
type Target = A::Data;
fn deref(&self) -> &Self::Target { &self.value }
}
impl<A: AtomicFeatures> ToExpr for TypAtom<A> {
impl<A: AtomicFeatures> ToExpr for TAtom<A> {
async fn to_expr(self) -> GExpr { self.untyped.to_expr().await }
}