Trait seq_io::BufStrategy [−][src]
Strategy that decides how a buffer should grow
Returns the number of additional bytes given the current size. Returning None instead will indicate that the buffer has grown too big. Creates a new reader with a given buffer capacity and growth strategy
Example
use seq_io::BufStrategy; use seq_io::fasta::{Reader,Record}; use std::io::stdin; struct Max1G; // This BufStrategy limits the buffer size to 1 GB impl BufStrategy for Max1G { fn grow_to(&mut self, current_size: usize) -> Option<usize> { if current_size > 1 << 30 { return None } Some(current_size * 2) } } let mut reader = Reader::with_cap_and_strategy(stdin(), 1 << 16, Max1G); while let Some(record) = reader.next() { println!("{}", record.unwrap().id().unwrap()); }
Required Methods
Implementors
impl BufStrategy for DoubleUntil8M
impl BufStrategy for DoubleUntil