use effectful::{environment::{Environment, NativeForm}, is_send_sync, effective::Effective};
use crate::{
never::Never,
protocol::DynVisitor,
};
/// A walker that does nothing.
///
/// This walker is useful for tags that don't need a value.
#[non_exhaustive]
#[derive(Debug, Default)]
pub struct NoopWalker;
is_send_sync!(NoopWalker);
impl NoopWalker {
pub fn new() -> Self {
Self
}
}
impl<'ctx, E: Environment> crate::Walker<'ctx, E> for NoopWalker {
type Error = Never;
type Output = ();
fn walk<'b: 'c, 'c>(
self,
_visitor: DynVisitor<'b, 'ctx, E>,
) -> NativeForm<'c, Result<Self::Output, Self::Error>, E> {
E::value(Ok(())).cast()
}
}