File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ use log::log_enabled;
2
2
use openssl:: ssl:: { Ssl , SslContextBuilder , SslFiletype , SslMethod } ;
3
3
use simplelog:: * ;
4
4
use std:: collections:: VecDeque ;
5
+ use std:: fmt;
5
6
use std:: io:: { Read , Write } ;
6
7
use std:: rc:: Rc ;
7
8
use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
@@ -188,6 +189,18 @@ impl Packet {
188
189
}
189
190
}
190
191
192
+ impl fmt:: Display for Packet {
193
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
194
+ write ! ( f, "packet dump:\n " ) ?;
195
+ write ! ( f, " channel: {:02X}\n " , self . channel) ?;
196
+ write ! ( f, " flags: {:02X}\n " , self . flags) ?;
197
+ write ! ( f, " final length: {:04X?}\n " , self . final_length) ?;
198
+ write ! ( f, " payload: {:02X?}\n " , self . payload. clone( ) . into_iter( ) ) ?;
199
+
200
+ Ok ( ( ) )
201
+ }
202
+ }
203
+
191
204
/// shows packet/message contents as pretty string for debug
192
205
pub async fn pkt_debug ( pkt : & Packet ) -> Result < ( ) > {
193
206
// don't run further if we are not in Debug mode
You can’t perform that action at this time.
0 commit comments