Trait ssh_protocol::Decode

source ·
pub trait Decode: Sized {
    type Error: From<Error>;

    // Required method
    fn decode(reader: &mut impl Reader) -> Result<Self, Self::Error>;
}
Expand description

Decoding trait.

This trait describes how to decode a given type.

Required Associated Types§

source

type Error: From<Error>

Type returned in the event of a decoding error.

Required Methods§

source

fn decode(reader: &mut impl Reader) -> Result<Self, Self::Error>

Attempt to decode a value of this type using the provided Reader.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Decode for CertType

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<CertType, Error>

source§

impl Decode for KeypairData

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<KeypairData, Error>

source§

impl Decode for KeyData

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<KeyData, Error>

source§

impl Decode for u8

Decode a single byte from the input data.

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<u8, Error>

source§

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.

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<u32, Error>

source§

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).

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<u64, Error>

source§

impl Decode for usize

Decode a usize.

Uses Decode impl on u32 and then converts to a usize, handling potential overflow if usize is smaller than u32.

Enforces a library-internal limit of 1048575, as the main use case for usize is length prefixes.

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<usize, Error>

source§

impl Decode for String

Available on crate feature alloc only.
§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<String, Error>

source§

impl Decode for Vec<u8>

Available on crate feature alloc only.

Decodes Vec<u8> 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.

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<Vec<u8>, Error>

source§

impl Decode for Vec<String>

Available on crate feature alloc only.
§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<Vec<String>, Error>

source§

impl Decode for OptionsMap

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<OptionsMap, Error>

source§

impl Decode for Mpint

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<Mpint, Error>

source§

impl Decode for DsaKeypair

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<DsaKeypair, Error>

source§

impl Decode for DsaPrivateKey

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<DsaPrivateKey, Error>

source§

impl Decode for Ed25519Keypair

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<Ed25519Keypair, Error>

source§

impl Decode for OpaqueKeypairBytes

source§

impl Decode for OpaquePrivateKeyBytes

source§

impl Decode for RsaKeypair

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<RsaKeypair, Error>

source§

impl Decode for RsaPrivateKey

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<RsaPrivateKey, Error>

source§

impl Decode for SkEd25519

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<SkEd25519, Error>

source§

impl Decode for DsaPublicKey

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<DsaPublicKey, Error>

source§

impl Decode for Ed25519PublicKey

source§

impl Decode for OpaquePublicKeyBytes

source§

impl Decode for RsaPublicKey

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<RsaPublicKey, Error>

source§

impl Decode for SkEd25519

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<SkEd25519, Error>

source§

impl Decode for SshSig

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<SshSig, Error>

source§

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.

§

type Error = Error

source§

fn decode(reader: &mut impl Reader) -> Result<[u8; N], Error>

Implementors§