chunks 0.1.1

Parallel-ish chunk loading that might make things slower.
Documentation
use Store;

/// A chunk. Don't touch its insides unless you know what you're doing!
pub enum Chunk<S: Store> {
    /// A chunk that loaded successfully.
    Good {
        /// Whether the chunk needs to be saved.
        save: bool,
        /// The stuff you care about.
        value: S::Value,
    },
    /// Take a guess.
    Bad,
}

impl<S: Store> Chunk<S> {
    /// Read some stuff.
    #[inline]
    pub fn get(&self) -> Option<&S::Value> {
        if let Chunk::Good { value, .. } = self {
            Some(value)
        } else {
            None
        }
    }

    /// Make some changes.
    #[inline]
    pub fn get_mut(&mut self) -> Option<&mut S::Value> {
        if let Chunk::Good { save, value } = self {
            *save = true;
            Some(value)
        } else {
            None
        }
    }
}