Trait mayda::utility::Encodable [] [src]

pub trait Encodable<B: Bits> {
    fn encode(&mut self, &[B]) -> Result<()Error>;
    fn decode(&self) -> Result<Vec<B>, Error>;
}

Indicates that the type can be encoded and decoded by mayda.

The default implementations of encode and decode return errors to indicate that there is no available specialization for the type. This should not happen unless the user implements Bits for some other type or there is a library bug.

Required Methods

fn encode(&mut self, &[B]) -> Result<()Error>

Encodes the slice in the Encodable object.

fn decode(&self) -> Result<Vec<B>, Error>

Decodes the slice in the Encodable object. An encoded vector type must give ownership of the returned value to the caller.

Implementors