bluefin 0.1.6

An experimental, secure, P2P, transport-layer protocol.
Documentation
use error::BluefinError;

pub mod context;
pub mod error;
pub mod header;
pub mod packet;

pub trait Extract: Default {
    /// Replace self with default and returns the initial value.
    fn extract(&mut self) -> Self;
}

impl<T: Default> Extract for T {
    fn extract(&mut self) -> Self {
        std::mem::replace(self, T::default())
    }
}

pub trait Serialisable {
    fn serialise(&self) -> Vec<u8>;
    fn deserialise(bytes: &[u8]) -> Result<Self, BluefinError>
    where
        Self: Sized;
}