Diffstat (limited to 'src/protocol/visitor/request_hint.rs')
-rw-r--r--src/protocol/visitor/request_hint.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/protocol/visitor/request_hint.rs b/src/protocol/visitor/request_hint.rs
new file mode 100644
index 0000000..bd5b12d
--- /dev/null
+++ b/src/protocol/visitor/request_hint.rs
@@ -0,0 +1,17 @@
+use core::ops::ControlFlow;
+
+use crate::{nameable, protocol::Walker};
+
+/// Protocol for requesting a hint from a visitor.
+pub trait RequestHint<'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(&mut self, walker: Walker<'_, 'ctx>) -> ControlFlow<()>;
+}
+
+nameable! {
+ pub ['a, 'ctx]
+ dyn RequestHint<'ctx> + 'a where {'ctx: 'a}
+}