|
@@ -7,9 +7,28 @@
|
|
|
//!
|
|
|
//! A packet can be formatted using the `PrettyPrinter` wrapper:
|
|
|
//!
|
|
|
-//! ```rust,ignore
|
|
|
-//! print!("{}", PrettyPrinter::<EthernetFrame<_>>::new("", &buffer))
|
|
|
-//! ```
|
|
|
+/*!
|
|
|
+```rust
|
|
|
+use smoltcp::wire::*;
|
|
|
+let buffer = vec![
|
|
|
+ // Ethernet II
|
|
|
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
|
|
|
+ 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
|
|
|
+ 0x08, 0x00,
|
|
|
+ // IPv4
|
|
|
+ 0x45, 0x00, 0x00, 0x18,
|
|
|
+ 0x00, 0x00, 0x40, 0x00,
|
|
|
+ 0x40, 0x01, 0xd2, 0x79,
|
|
|
+ 0x11, 0x12, 0x13, 0x14,
|
|
|
+ 0x21, 0x22, 0x23, 0x24,
|
|
|
+ // ICMPv4
|
|
|
+ 0x08, 0x00, 0x8e, 0xfe,
|
|
|
+ 0x12, 0x34, 0xab, 0xcd,
|
|
|
+ 0xaa, 0x00, 0x00, 0xff
|
|
|
+];
|
|
|
+print!("{}", PrettyPrinter::<EthernetFrame<&'static [u8]>>::new("", &buffer));
|
|
|
+```
|
|
|
+*/
|
|
|
|
|
|
use core::fmt;
|
|
|
use core::marker::PhantomData;
|