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 core::ops::ControlFlow;

use crate::{
    effect::{Effect, Future},
    nameable,
    protocol::Walker,
};

/// Protocol for requesting a hint from a visitor.
pub trait RequestHint<'ctx> {
    type Effect: Effect<'ctx>;

    /// 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: Walker<'a, 'ctx>,
    ) -> Future<'a, 'ctx, ControlFlow<(), ()>, Self::Effect>
    where
        Self: 'a;
}

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