//! SBD message storage.
//!
//! We can store messages in one of several backends, provided as submodules here. Storages
//! implement the `Storage` trait.

mod filesystem;
mod memory;

pub use self::filesystem::Storage as FilesystemStorage;
pub use self::memory::Storage as MemoryStorage;

use Result;
use mo::Message;

/// Trait for all backend SBD storages.
pub trait Storage {
    /// Stores message in this storage.
    fn store(&mut self, message: &Message) -> Result<()>;
}

//! Squirrel away SBD messages and retrieve them later.

mod filesystem;
mod memory;

pub use self::filesystem::Storage as FilesystemStorage;
pub use self::memory::Storage as MemoryStorage;

use Result;
use mo::Message;

/// Basic storage operations.
pub trait Storage {
    /// Place a message into this storage.
    ///
    /// # Examples
    ///
    /// ```
    /// # use sbd::mo::Message;
    /// # use sbd::storage::{Storage, MemoryStorage};
    /// let message = Message::from_path("data/0-mo.sbd").unwrap();
    /// let mut storage = MemoryStorage::new();
    /// storage.store(&message);
    /// ```
    fn store(&mut self, message: &Message) -> Result<()>;
}

Add doc test for store
Add doc test for store
