Trait io_truncate::Truncate [−][src]
Expand description
A trait for IO objects that can be shortened.
See the documentation comments on individual implementations for some potentially important notes on their specific behaviors.
Required methods
Truncate the object to the given new length in bytes.
The behavior when new_len
is larger than the current length of the object is unspecified.
Implementations may choose to panic or extend the data in some way.
Example
let mut v: &[u8] = &[0, 1, 2, 3]; v.truncate(3).unwrap(); assert_eq!(v, &[0, 1, 2]);