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§
Sourcefn to_signed(&self) -> Result<SignedCredits, ProtocolError>
fn to_signed(&self) -> Result<SignedCredits, ProtocolError>
Convert unsigned credit to singed
Sourcefn to_unsigned(&self) -> Credits
fn to_unsigned(&self) -> Credits
Convert singed credit to unsigned
Sourcefn from_vec_bytes(vec: Vec<u8>) -> Result<Self, ProtocolError>where
Self: Sized,
fn from_vec_bytes(vec: Vec<u8>) -> Result<Self, ProtocolError>where
Self: Sized,
Decode bytes to credits
Sourcefn to_vec_bytes(&self) -> Vec<u8> ⓘ
fn to_vec_bytes(&self) -> Vec<u8> ⓘ
Encode credits to bytes