base_xx 0.1.1

Base X encoding
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/// A trait for types that can be converted to bytes.
///
/// This trait should be implemented by types that can be serialized into
/// a byte representation. The associated `Error` type specifies what kind
/// of errors can occur during serialization.
pub trait AsBytes {
    /// The type of error that can occur during serialization.
    type Error;

    /// Attempts to convert this value to its byte representation.
    ///
    /// # Errors
    ///
    /// Returns `Self::Error` if serialization fails.
    fn try_as_bytes(&self) -> Result<Vec<u8>, Self::Error>;
}