pub struct Config {
pub chunk_size: GrowthStrategy,
pub spawn_finaliser: Finaliser,
pub use_backing: bool,
pub length_hint: Option<usize>,
pub read_burst_len: usize,
}
Expand description
Options controlling backing store allocation, finalisation, and so on.
Fields§
§chunk_size: GrowthStrategy
§spawn_finaliser: Finaliser
§use_backing: bool
§length_hint: Option<usize>
§read_burst_len: usize
Implementations§
Source§impl Config
impl Config
pub fn new() -> Self
Sourcepub fn chunk_size(self, size: GrowthStrategy) -> Self
pub fn chunk_size(self, size: GrowthStrategy) -> Self
The amount of bytes to allocate whenever more space is required to store the stream.
A larger value is generally preferred for minimising locking and allocations, but may reserve too much space before the struct is finalised.
Defaults to Constant(4096)
. Start be larger than the transform’s minimum chunk size.
Sourcepub fn use_backing(self, val: bool) -> Self
pub fn use_backing(self, val: bool) -> Self
Allocate a single contiguous backing store to speed up reads after the stream ends.
Defaults to true
.
Sourcepub fn spawn_finaliser(self, finaliser: Finaliser) -> Self
pub fn spawn_finaliser(self, finaliser: Finaliser) -> Self
Spawn a new thread/task to move contents of the rope into backing storage once a stream completes.
Disabling this may negatively impact performance of the final read in a stream.
Defaults to Finaliser::NewThread
.
Sourcepub fn length_hint(self, hint: Option<usize>) -> Self
pub fn length_hint(self, hint: Option<usize>) -> Self
Estimate for the amount of data required to store the completed stream.
On None
, this will be set to chunk_size
.
Defaults to None
.
Sourcepub fn read_burst_len(self, burst: usize) -> Self
pub fn read_burst_len(self, burst: usize) -> Self
The minimum size of reads to attempt from the input stream, if possible.
Defaults to 4096
.