view src/options.rs @ 13:6a28e181a306

Rename Options->BuildOptions, and add ReadOptions
author Lewin Bormann <lbo@spheniscida.de>
date Mon, 21 Nov 2016 19:26:37 +0100
parents 14484cc26b69
children e169ac78539d
line wrap: on
line source

use std::default::Default;

#[derive(Clone, Copy, PartialEq, Debug)]
pub enum CompressionType {
    CompressionNone = 0,
    CompressionSnappy = 1,
}

/// [not all member types implemented yet]
///
#[derive(Clone, Copy)]
pub struct BuildOptions {
    pub block_size: usize,
    pub block_restart_interval: usize,
    // Note: Compression is not implemented.
    pub compression_type: CompressionType,
}

impl Default for BuildOptions {
    fn default() -> BuildOptions {
        BuildOptions {
            block_size: 4 * (1 << 10),
            block_restart_interval: 16,
            compression_type: CompressionType::CompressionNone,
        }
    }
}

#[derive(Clone, Copy)]
pub struct ReadOptions {
    pub skip_bad_blocks: bool
}

impl Default for ReadOptions {
    fn default() -> ReadOptions {
        ReadOptions { skip_bad_blocks: true }
    }
}