Diffstat (limited to 'src/builtins/visitor/request_hint.rs')
-rw-r--r--src/builtins/visitor/request_hint.rs26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/builtins/visitor/request_hint.rs b/src/builtins/visitor/request_hint.rs
index 6ab797a..747fa8e 100644
--- a/src/builtins/visitor/request_hint.rs
+++ b/src/builtins/visitor/request_hint.rs
@@ -1,23 +1,17 @@
-//! Protocol for requesting a visitor give a hint to walker.
-///
-/// Some walkers don't know what the data they are walking actually represents.
-/// This protocol allows such walkers to request the visitor to give a hint of what
-/// it is expecting.
-use crate::protocol::{Implementer, Protocol};
+use core::ops::ControlFlow;
-/// Protocol for requesting a visitor give a hint.
-pub enum RequestHint {}
+use crate::{nameable, any::AnyTrait, builtins::Walker};
-/// Object implementing the [`RequestHint`] protocol.
-pub trait RequestHintObject<'ctx> {
+/// Protocol for requesting a hint from a visitor.
+pub trait RequestHint<'ctx> {
/// Call this to request a hint.
///
- /// `hints` is expected to be the walker. This is what the visitor (`Self`)
- /// will call to give a hint using the
- /// [`Hint`][crate::builtins::walker::hint::Hint] protocol.
- fn request_hint(&mut self, hints: &mut dyn Implementer<'ctx>) -> Result<(), ()>;
+ /// `walker` is what the visitor (`self`) will call to give a hint using the
+ /// [`Hint`][crate::builtins::walker::Hint] protocol.
+ fn request_hint(&mut self, walker: Walker<'_, 'ctx>) -> ControlFlow<()>;
}
-impl Protocol for RequestHint {
- type Object<'a, 'ctx: 'a> = &'a mut dyn RequestHintObject<'ctx>;
+nameable! {
+ pub ['a, 'ctx]
+ dyn RequestHint<'ctx> + 'a where {'ctx: 'a}
}