Creditable

Trait Creditable 

Source
pub trait Creditable {
    // Required methods
    fn to_signed(&self) -> Result<SignedCredits, ProtocolError>;
    fn to_unsigned(&self) -> Credits;
    fn from_vec_bytes(vec: Vec<u8>) -> Result<Self, ProtocolError>
       where Self: Sized;
    fn to_vec_bytes(&self) -> Vec<u8> ;
}
Expand description

Trait for signed and unsigned credits

Required Methods§

Source

fn to_signed(&self) -> Result<SignedCredits, ProtocolError>

Convert unsigned credit to singed

Source

fn to_unsigned(&self) -> Credits

Convert singed credit to unsigned

Source

fn from_vec_bytes(vec: Vec<u8>) -> Result<Self, ProtocolError>
where Self: Sized,

Decode bytes to credits

Source

fn to_vec_bytes(&self) -> Vec<u8>

Encode credits to bytes

Implementors§