Clean up a few doctests.
parent
be29789192
commit
cc5fb0e5ef
|
@ -28,7 +28,7 @@ fn rx_full() -> bool {
|
|||
false
|
||||
}
|
||||
|
||||
fn rx_setup(buf: *mut u8, length: &mut usize) {
|
||||
fn rx_setup(_buf: *mut u8, _length: &mut usize) {
|
||||
/* platform-specific code to receive a packet into a buffer */
|
||||
}
|
||||
|
||||
|
@ -37,11 +37,12 @@ fn tx_empty() -> bool {
|
|||
false
|
||||
}
|
||||
|
||||
fn tx_setup(buf: *const u8, length: usize) {
|
||||
fn tx_setup(_buf: *const u8, _length: usize) {
|
||||
/* platform-specific code to send a buffer with a packet */
|
||||
}
|
||||
|
||||
struct EthernetDevice {
|
||||
# #[allow(dead_code)]
|
||||
pub struct EthernetDevice {
|
||||
tx_next: usize,
|
||||
rx_next: usize
|
||||
}
|
||||
|
@ -84,7 +85,7 @@ impl Device for EthernetDevice {
|
|||
}
|
||||
}
|
||||
|
||||
struct EthernetTxBuffer(&'static mut [u8]);
|
||||
pub struct EthernetTxBuffer(&'static mut [u8]);
|
||||
|
||||
impl AsRef<[u8]> for EthernetTxBuffer {
|
||||
fn as_ref(&self) -> &[u8] { self.0 }
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue