use effectful::{
effective::Effective,
environment::{Environment, NativeForm},
higher_ranked::Mut,
is_send_sync,
};
use crate::{
any_trait,
protocol::{visitor::VisitResult, DynVisitor},
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)]
#[non_exhaustive]
pub struct NoopVisitor;
is_send_sync!(NoopVisitor);
impl NoopVisitor {
pub fn new() -> Self {
Self
}
}
any_trait! {
impl['ctx][E] NoopVisitor = [] where E: Environment
}
impl NoopVisitor {
pub fn walk_dyn<'ctx: 'e, 'walker: 'e, 'e, E: Environment>(
walker: DynWalkerObjSafe<'walker, 'ctx, E>,
) -> NativeForm<'e, VisitResult, E> {
E::value(NoopVisitor::new())
.update(walker, |walker, noop| {
walker
.walk(DynVisitor(noop))
.map((), |_, x| x.to_continue().into())
.cast()
})
.map((), |_, (_, x)| x)
.cast()
}
}