}
dst.reserve(src.len());
- self.trellis.truncate(0);
+ self.trellis.clear();
self.trellis.reserve(src.len() + 1);
for _ in 0..=src.len() {
self.trellis.push(TNode::default());
Mode::Fixed => {
wr.write(final_block as u16, 1);
wr.write(1, 2);
- self.tokens.truncate(0);
+ self.tokens.clear();
self.parser.parse(&self.srcbuf[..self.ssize], &mut self.tokens);
let mut codes = CodeHuff::new(true);
codes.make_codes(&self.tokens);
Mode::Dynamic => {
wr.write(final_block as u16, 1);
wr.write(2, 2);
- self.tokens.truncate(0);
+ self.tokens.clear();
self.parser.parse(&self.srcbuf[..self.ssize], &mut self.tokens);
let mut codes = CodeHuff::new(false);
codes.make_codes(&self.tokens);
}
/// Clears the pool from all frames.
pub fn reset(&mut self) {
- self.pool.truncate(0);
+ self.pool.clear();
}
}
fn flush(&mut self) {
self.last_ref_dts = None;
self.ready_idx = 0;
- self.frames.truncate(0);
+ self.frames.clear();
}
fn get_last_frames(&mut self) -> Option<NAFrameRef> {
if !self.frames.is_empty() {
self.clusters[i].reset();
}
// put pixels into the nearest clusters
- indices.truncate(0);
+ indices.clear();
for entry in entries.iter() {
let mut bestidx = 0;
let mut bestdist = std::u32::MAX;
}
let dmean = dist / 256;
- low_u.truncate(0);
- high_u.truncate(0);
+ low_u.clear();
+ high_u.clear();
let mut used = [false; 256];
for (i, cluster) in self.clusters.iter().enumerate() {
if cluster.dist < dmean {
let ofmt = dbuf.get_info().get_format();
let dst = dbuf.get_data_mut().unwrap();
- pixels.truncate(0);
+ pixels.clear();
if !ifmt.is_unpacked() {
let esize = ifmt.elem_size as usize;
let coffs = [ifmt.comp_info[0].unwrap().comp_offs as usize, ifmt.comp_info[1].unwrap().comp_offs as usize, ifmt.comp_info[2].unwrap().comp_offs as usize];