assay-sim 3.27.0

Simulation harness for Assay (internal, API unstable)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use super::Mutator;
use anyhow::Result;

pub struct Truncate {
    pub at: usize,
}

impl Mutator for Truncate {
    fn mutate(&self, data: &[u8]) -> Result<Vec<u8>> {
        let mut corrupted = data.to_vec();
        if self.at < corrupted.len() {
            corrupted.truncate(self.at);
        }
        Ok(corrupted)
    }
}