tsp_sdk 0.9.0-alpha2

Rust implementation of the Trust Spanning Protocol
Documentation
/// An error type to indicate something went wrong with encoding
#[derive(Clone, Copy, Debug)]
pub enum EncodeError {
    ExcessiveFieldSize,
    MissingHops,
    MissingReceiver,
    InvalidVid,
}

/// An error type to indicate something went wrong with decoding
#[derive(Clone, Copy, Debug)]
pub enum DecodeError {
    UnexpectedData,
    UnexpectedMsgType,
    TrailingGarbage,
    SignatureError,
    VidError,
    VersionMismatch,
    InvalidCryptoType,
    InvalidSignatureType,
    MissingHops,
    UnknownCrypto,
    InvalidCrypto,
}

impl std::fmt::Display for EncodeError {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
        write!(f, "{self:?}")
    }
}

impl std::fmt::Display for DecodeError {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
        write!(f, "{self:?}")
    }
}

impl std::error::Error for EncodeError {}

impl std::error::Error for DecodeError {}