1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use crate::{
    effect::{Effect, ErasedEffective},
    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;

impl NoopWalker {
    pub fn new() -> Self {
        Self
    }
}

impl<'ctx, E: Effect> crate::Walker<'ctx, E> for NoopWalker {
    type Error = Never;

    type Output = ();

    fn walk<'b: 'c, 'c>(
        self,
        _visitor: DynVisitor<'b, 'ctx>,
    ) -> ErasedEffective<'c, Result<Self::Output, Self::Error>, E> {
        E::ready(Ok(()))
    }
}