Diffstat (limited to 'src/protocol/visitor/sequence.rs')
| -rw-r--r-- | src/protocol/visitor/sequence.rs | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/protocol/visitor/sequence.rs b/src/protocol/visitor/sequence.rs index 25ba8dd..23bc3ce 100644 --- a/src/protocol/visitor/sequence.rs +++ b/src/protocol/visitor/sequence.rs @@ -7,10 +7,13 @@ use crate::{ Flow, }; -use super::Status; +use super::VisitResult; pub trait Sequence<'ctx, E: Effect> { - fn visit<'a>(&'a mut self, scope: DynSequenceScope<'a, 'ctx, E>) -> Future<'a, Flow, E>; + fn visit<'a>( + &'a mut self, + scope: DynSequenceScope<'a, 'ctx, E>, + ) -> Future<'a, VisitResult<DynSequenceScope<'a, 'ctx, E>>, E>; } bijective_higher_ranked_type! { @@ -61,23 +64,12 @@ impl<'ctx, E: Effect> HintMeta<'ctx> for DynSequence<'ctx, E> { pub fn visit_sequence<'a, 'ctx, E: Effect>( visitor: Visitor<'a, 'ctx>, scope: DynSequenceScope<'a, 'ctx, E>, -) -> Future<'a, Status, E> { +) -> Future<'a, VisitResult<DynSequenceScope<'a, 'ctx, E>>, E> { if let Some(object) = visitor.upcast_mut::<DynSequence<'ctx, E>>() { // Allow the visitor to give a hint if it wants. - E::map(object.visit(scope), |flow| match flow { - Flow::Continue => { - // The visitor wants the walker to continue to it's normal - // walking. - Status::r#continue() - } - Flow::Break | Flow::Done => { - // The visitor is done (either because of an error or because - // it already used a hint). - Status::r#break() - } - }) + object.visit(scope) } else { // If the visitor doesn't support request hint then we continue. - E::ready(Status::skipped()) + E::ready(VisitResult::Skipped(scope)) } } |