File tree Expand file tree Collapse file tree 8 files changed +66
-8
lines changed
Expand file tree Collapse file tree 8 files changed +66
-8
lines changed Original file line number Diff line number Diff line change 1- #![ allow( warnings) ]
21pub mod body_struct;
32pub mod reader;
Original file line number Diff line number Diff line change 1- //#![allow(warnings)]
21pub mod abnf;
32pub mod body_headers;
43pub mod const_headers;
Original file line number Diff line number Diff line change 1- //#![feature(test)]
2-
31mod content_type;
4- mod mime_type;
52pub use content_type:: * ;
3+ mod mime_type;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ [package ]
2+ name = " protocol_plz"
3+ version = " 0.0.1"
4+ authors = [" darkseid" , " sytten <emile@caido.io>" ]
5+ description = " Protocol for the ParsePlz ecosystem"
6+ repository = " https://github.com/parseplz/primitives"
7+ license = " MIT"
8+ edition = " 2024"
9+
10+ [dependencies ]
11+ buffer-plz = { path = " ../buffer-plz" , version = " 0.0.1" }
12+ bytes = { workspace = true }
Original file line number Diff line number Diff line change 1+ use bytes:: BytesMut ;
2+
3+ // Trait to convert frame to bytesmut
4+ pub trait Frame {
5+ fn into_data ( self ) -> BytesMut ;
6+ }
Original file line number Diff line number Diff line change 1+ mod frame;
2+ pub use frame:: Frame ;
3+ mod step;
4+ pub use step:: Step ;
Original file line number Diff line number Diff line change 1+ use buffer:: Event ;
2+
3+ use crate :: frame:: Frame ;
4+
5+ /* Description:
6+ * Trait to read a frame.
7+ *
8+ * Methods:
9+ * next()
10+ * Description : Process the event generated by IO to proceed with
11+ * the next step.
12+ * Args : Event
13+ * Returns : Self
14+ * Errors : StateError
15+ *
16+ * is_ended()
17+ * Description : Check if a frame has been read.
18+ * Returns : bool
19+ *
20+ * get_frame()
21+ * Description : Consumes the state machine and returns the frame.
22+ * Returns : T
23+ * Errors : FrameError
24+ *
25+ * Implementation:
26+ * OneOneState
27+ */
28+
29+ pub trait Step < T >
30+ where
31+ T : Frame ,
32+ {
33+ type StateError ;
34+ type FrameError ;
35+
36+ fn next ( self , event : Event ) -> Result < Self , Self :: StateError >
37+ where
38+ Self : Sized ;
39+
40+ fn is_ended ( & self ) -> bool ;
41+
42+ fn into_frame ( self ) -> Result < T , Self :: FrameError > ;
43+ }
You can’t perform that action at this time.
0 commit comments