Diffstat (limited to 'src/protocol/visitor.rs')
| -rw-r--r-- | src/protocol/visitor.rs | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/src/protocol/visitor.rs b/src/protocol/visitor.rs index aad879d..9fc98c0 100644 --- a/src/protocol/visitor.rs +++ b/src/protocol/visitor.rs @@ -1,15 +1,41 @@ +use crate::Flow; + +pub mod recoverable; pub mod request_hint; pub mod sequence; pub mod tag; pub mod value; -pub enum Status { - /// The protocol was used. - Continue, - +pub enum Status<S = ()> { /// The protocol was not used. - Skipped, + Skipped(S), + + Flow(Flow) +} + +impl<S> Status<S> { + pub fn r#continue() -> Self { + Self::Flow(Flow::Continue) + } + + pub fn done() -> Self { + Self::Flow(Flow::Done) + } - /// Should stop processing. - Break, + pub fn r#break() -> Self { + Self::Flow(Flow::Break) + } } + +impl Status { + pub fn skipped() -> Self { + Self::Skipped(()) + } +} + +impl From<Flow> for Status { + fn from(value: Flow) -> Self { + Status::Flow(value) + } +} + |