1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use crate::{
    nameable,
    protocol::{ControlFlowFor, Effect, SyncEffect, Walker},
};

/// Protocol for requesting a hint from a visitor.
pub trait RequestHint<'ctx, E: Effect = SyncEffect> {
    /// Call this to request a hint.
    ///
    /// `walker` is what the visitor (`self`) will call to give a hint using the
    /// [`Hint`][crate::builtins::walker::Hint] protocol.
    fn request_hint<'a>(&'a mut self, walker: &'a mut Walker<'a, 'ctx>) -> ControlFlowFor<'a, E>;
}

nameable! {
    pub struct Name['a, 'ctx, E];
    impl [E] for dyn RequestHint<'ctx, E> + 'a where {
        E: Effect + 'static,
        'ctx: 'a
    }
}