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
}
}