Diffstat (limited to 'src/protocol/visitor.rs')
| -rw-r--r-- | src/protocol/visitor.rs | 48 |
1 files changed, 19 insertions, 29 deletions
diff --git a/src/protocol/visitor.rs b/src/protocol/visitor.rs index af82045..fd8d8cd 100644 --- a/src/protocol/visitor.rs +++ b/src/protocol/visitor.rs @@ -1,41 +1,31 @@ use crate::Flow; -pub mod recoverable; -pub mod request_hint; -pub mod sequence; -pub mod tag; -pub mod value; +mod recoverable; +mod request_hint; +mod sequence; +mod tag; +mod value; + +pub use recoverable::*; +pub use request_hint::*; +pub use sequence::*; +pub use tag::*; +pub use value::*; #[derive(Debug)] -pub enum Status<S = ()> { +pub enum VisitResult<S> { /// The protocol was not used. + /// + /// This either means the visitor doesn't support the protocol at all, or + /// it didn't want to use the protocol right now. Skipped(S), - Flow(Flow), + /// How control flow should proceed. + Control(Flow), } -impl<S> Status<S> { - pub fn r#continue() -> Self { - Self::Flow(Flow::Continue) - } - - pub fn done() -> Self { - Self::Flow(Flow::Done) - } - - pub fn r#break() -> Self { - Self::Flow(Flow::Break) - } -} - -impl Status { - pub fn skipped() -> Self { - Self::Skipped(()) - } -} - -impl From<Flow> for Status { +impl<S> From<Flow> for VisitResult<S> { fn from(value: Flow) -> Self { - Status::Flow(value) + Self::Control(value) } } |