use crate::{
effect::{Effect, ObjSafe},
never::Never,
protocol::DynVisitor,
WalkerTypes,
};
/// 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;
impl NoopWalker {
pub fn new() -> Self {
Self
}
}
impl WalkerTypes for NoopWalker {
type Error = Never;
type Output = ();
}
impl<'ctx, E: Effect> crate::Walker<'ctx, E> for NoopWalker {
fn walk<'b: 'c, 'c>(
self,
_visitor: DynVisitor<'b, 'ctx>,
) -> ObjSafe<'c, Result<Self::Output, Self::Error>, E> {
E::ready(Ok(())).into()
}
}