pub trait Decode: Sized {
type Error: From<Error>;
// Required method
fn decode(reader: &mut Decoder<impl Reader>) -> Result<Self, Self::Error>;
}Expand description
Decoding trait.
This trait describes how to decode a given type.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl Decode for Bytes
Available on crate feature bytes only.Decodes Bytes from string as described in RFC4251 § 5:
impl Decode for Bytes
bytes only.Decodes Bytes from string as described in RFC4251 § 5:
Arbitrary length binary string. Strings are allowed to contain arbitrary binary data, including null characters and 8-bit characters. They are stored as a uint32 containing its length (number of bytes that follow) and zero (= empty string) or more bytes that are the value of the string. Terminating null characters are not used.
Source§impl Decode for Vec<String>
Available on crate feature alloc only.Decodes Vec<String> from an SSH string containing a sequence of SSH string values.
impl Decode for Vec<String>
alloc only.Decodes Vec<String> from an SSH string containing a sequence of SSH string values.
The outer uint32 length prefix covers all encoded entries, including their individual
length prefixes. Each entry is decoded as UTF-8. This encoding is used for the valid
principals field in OpenSSH certificates.
This differs from the comma-separated name-list encoding described in RFC4251 § 5.
Source§impl Decode for Vec<u8>
Available on crate feature alloc only.Decodes Vec<u8> from string as described in RFC4251 § 5:
impl Decode for Vec<u8>
alloc only.Decodes Vec<u8> from string as described in RFC4251 § 5:
Arbitrary length binary string. Strings are allowed to contain arbitrary binary data, including null characters and 8-bit characters. They are stored as a uint32 containing its length (number of bytes that follow) and zero (= empty string) or more bytes that are the value of the string. Terminating null characters are not used.
Source§impl Decode for bool
Decode a boolean as described in RFC4251 § 5:
impl Decode for bool
Decode a boolean as described in RFC4251 § 5:
A boolean value is stored as a single byte. The value 0 represents FALSE, and the value 1 represents TRUE. All non-zero values MUST be interpreted as TRUE; however, applications MUST NOT store values other than 0 and 1.
Source§impl Decode for u32
Decode a uint32 as described in RFC4251 § 5:
impl Decode for u32
Decode a uint32 as described in RFC4251 § 5:
Represents a 32-bit unsigned integer. Stored as four bytes in the order of decreasing significance (network byte order). For example: the value 699921578 (0x29b7f4aa) is stored as 29 b7 f4 aa.
Source§impl Decode for u64
Decode a uint64 as described in RFC4251 § 5:
impl Decode for u64
Decode a uint64 as described in RFC4251 § 5:
Represents a 64-bit unsigned integer. Stored as eight bytes in the order of decreasing significance (network byte order).
Source§impl Decode for usize
Decode an SSH uint32 as a usize.
impl Decode for usize
Decode an SSH uint32 as a usize.
Returns Error::Overflow if the value does not fit in usize.
Use Decoder::read_prefixed to decode a length-prefixed field.
Source§impl<const N: usize> Decode for [u8; N]
Decodes a byte array from byte[n] as described in RFC4251 § 5:
impl<const N: usize> Decode for [u8; N]
Decodes a byte array from byte[n] as described in RFC4251 § 5:
A byte represents an arbitrary 8-bit value (octet). Fixed length data is sometimes represented as an array of bytes, written
byte[n], where n is the number of bytes in the array.
Note that unlike string, this type is encoded without a length prefix,
but instead implicitly obtains its length as N.