use effectful::{
effective::{Canonical, Effective},
environment::Environment,
SendSync,
};
use crate::{
any::AnyTrait,
protocol::{visitor::VisitResult, DynVisitor},
walk::DynWalkerObjSafe,
};
// pub mod array;
pub mod bool;
pub mod value;
// pub mod option;
// pub mod variant;
pub mod r#enum;
pub mod r#struct;
pub mod tag_name;
#[derive(Default, SendSync)]
#[non_exhaustive]
pub struct NoopVisitor;
impl NoopVisitor {
pub fn new() -> Self {
Self
}
}
impl<'lt, 'ctx: 'lt> AnyTrait<'lt, 'ctx> for NoopVisitor {
}
impl NoopVisitor {
pub fn walk_dyn<'ctx: 'd, 'walker: 'e, 'd: 'walker, 'e, E: Environment>(
walker: DynWalkerObjSafe<'walker, 'd, 'ctx, E>,
) -> Canonical<'e, VisitResult, E> {
E::value(NoopVisitor::new())
.update_map(walker, |walker, noop| {
walker
.walk(DynVisitor(noop))
.map((), |_, x| x.to_continue().into())
.cast()
})
.map((), |_, (_, x)| x)
.cast()
}
}