Skip to main content

dryice/
config.rs

1//! Writer and reader configuration types.
2//!
3//! This module defines the configuration objects that control how a
4//! `dryice` file is written. The primary user-facing construction path
5//! is the builder on [`DryIceWriter`](crate::DryIceWriter). Sequence,
6//! quality, and name codecs are selected via type parameters on the
7//! builder, not through this config.
8
9/// Top-level configuration for a [`DryIceWriter`](crate::DryIceWriter).
10///
11/// This struct carries block layout policy. Sequence, quality, and name
12/// codecs are selected via type parameters on the writer builder, not
13/// through this struct.
14#[derive(Debug, Clone, Default)]
15pub struct DryIceWriterOptions {
16    /// Block layout and sizing policy.
17    pub layout: BlockLayoutOptions,
18}
19
20/// Block size policy for the writer.
21#[derive(Debug, Clone, Copy, PartialEq, Eq)]
22pub enum BlockSizePolicy {
23    /// Target a specific number of records per block.
24    TargetRecords(usize),
25
26    /// Target a specific approximate byte size per block.
27    TargetBytes(usize),
28}
29
30/// Block layout and sizing policy.
31#[derive(Debug, Clone)]
32pub struct BlockLayoutOptions {
33    /// How the writer decides when to flush a block.
34    pub block_size: BlockSizePolicy,
35}
36
37impl Default for BlockLayoutOptions {
38    fn default() -> Self {
39        Self {
40            block_size: BlockSizePolicy::TargetRecords(8192),
41        }
42    }
43}