pub trait Truncate {
type Error: Into<LoftyError>;
// Required method
fn truncate(&mut self, new_len: u64) -> Result<(), Self::Error>;
}Expand description
Provides a method to truncate an object to the specified length
This is one component of the FileLike trait, which is used to provide implementors access to any
file saving methods such as AudioFile::save_to.
Take great care in implementing this for downstream types, as Lofty will assume that the container has the new length specified. If this assumption were to be broken, files will become corrupted.
§Examples
use lofty::io::Truncate;
let mut data = vec![1, 2, 3, 4, 5];
data.truncate(3);
assert_eq!(data, vec![1, 2, 3]);Required Associated Types§
sourcetype Error: Into<LoftyError>
type Error: Into<LoftyError>
The error type of the truncation operation