Diffstat (limited to 'src/protocol/visitor/request_hint.rs')
-rw-r--r--src/protocol/visitor/request_hint.rs25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/protocol/visitor/request_hint.rs b/src/protocol/visitor/request_hint.rs
index 50ae76d..f70fc29 100644
--- a/src/protocol/visitor/request_hint.rs
+++ b/src/protocol/visitor/request_hint.rs
@@ -1,7 +1,6 @@
use crate::{
effect::{Effect, Future},
nameable,
- never::Never,
protocol::{Visitor, Walker},
Flow,
};
@@ -27,28 +26,20 @@ nameable! {
/// Visit using the [`RequestHint`] protocol.
///
-/// If `true` is returned then the walker should stop.
-/// This is either because of an error or the visitor is done.
+/// If [`Flow::Continue`] is returned then the visitor wants/needs more information it didn't get
+/// from the hints.
+/// If [`Flow::Done`] is returned then the visitor doesn't need any more information and the walker
+/// should stop walking.
+/// If [`Flow::Break`] is returned then there was an error and the walker should stop walking.
pub fn visit_request_hint<'a, 'ctx, E: Effect<'ctx>>(
visitor: Visitor<'a, 'ctx>,
walker: Walker<'a, 'ctx>,
-) -> Future<'a, 'ctx, bool, E> {
+) -> Future<'a, 'ctx, Flow, E> {
if let Some(object) = visitor.upcast_mut::<DynRequestHint<'_, 'ctx, E>>() {
// Allow the visitor to give a hint if it wants.
- E::map(object.request_hint(walker), |flow| match flow {
- Flow::Continue => {
- // The visitor wants the walker to continue to it's normal
- // walking.
- false
- }
- _ => {
- // The visitor is done (either because of an error or because
- // it already used a hint).
- true
- }
- })
+ object.request_hint(walker)
} else {
// If the visitor doesn't support request hint then we continue.
- E::ready(false)
+ E::ready(Flow::Continue)
}
}