pub trait TrimBytes {
// Required method
fn trim(&self) -> &Self;
}
Expand description
Trait to trim a byte slice &[u8]
similarly to str::trim()
.
Required Methods§
sourcefn trim(&self) -> &Self
fn trim(&self) -> &Self
Returns a byte slice with leading and trailing whitespace removed.
Example
use t2plugin::slread::{SliceReader, TrimBytes};
use t2plugin::packet::Packet;
let slr = SliceReader::new(packet.l7_header());
// read the first line of the packet payload and trim it
let line = try!(slr.read_line()).trim();