Trait rustls::internal::msgs::codec::Codec

source ·
pub trait Codec: Debug + Sized {
    // Required methods
    fn encode(&self, bytes: &mut Vec<u8>);
    fn read(_: &mut Reader<'_>) -> Option<Self>;

    // Provided methods
    fn get_encoding(&self) -> Vec<u8> { ... }
    fn read_bytes(bytes: &[u8]) -> Option<Self> { ... }
}
Expand description

Trait for implementing encoding and decoding functionality on something.

Required Methods§

source

fn encode(&self, bytes: &mut Vec<u8>)

Function for encoding itself by appending itself to the provided vec of bytes.

source

fn read(_: &mut Reader<'_>) -> Option<Self>

Function for decoding itself from the provided reader will return Some if the decoding was successful or None if it was not.

Provided Methods§

source

fn get_encoding(&self) -> Vec<u8>

Convenience function for encoding the implementation into a vec and returning it

source

fn read_bytes(bytes: &[u8]) -> Option<Self>

Function for wrapping a call to the read function in a Reader for the slice of bytes provided

Implementations on Foreign Types§

source§

impl Codec for u8

source§

fn encode(&self, bytes: &mut Vec<u8>)

source§

fn read(r: &mut Reader<'_>) -> Option<Self>

source§

impl Codec for u16

source§

fn encode(&self, bytes: &mut Vec<u8>)

source§

fn read(r: &mut Reader<'_>) -> Option<Self>

source§

impl Codec for u32

source§

fn encode(&self, bytes: &mut Vec<u8>)

source§

fn read(r: &mut Reader<'_>) -> Option<Self>

source§

impl Codec for u64

source§

fn encode(&self, bytes: &mut Vec<u8>)

source§

fn read(r: &mut Reader<'_>) -> Option<Self>

Implementors§

source§

impl Codec for CipherSuite

source§

impl Codec for ProtocolVersion

source§

impl Codec for SignatureScheme

source§

impl Codec for AlertDescription

source§

impl Codec for AlertLevel

source§

impl Codec for CertificateStatusType

source§

impl Codec for ClientCertificateType

source§

impl Codec for Compression

source§

impl Codec for ContentType

source§

impl Codec for ECCurveType

source§

impl Codec for ECPointFormat

source§

impl Codec for ExtensionType

source§

impl Codec for HandshakeType

source§

impl Codec for HashAlgorithm

source§

impl Codec for HeartbeatMessageType

source§

impl Codec for HeartbeatMode

source§

impl Codec for KeyUpdateRequest

source§

impl Codec for NamedCurve

source§

impl Codec for NamedGroup

source§

impl Codec for PSKKeyExchangeMode

source§

impl Codec for ServerNameType

source§

impl Codec for SignatureAlgorithm

source§

impl Codec for CertReqExtension

source§

impl Codec for CertificateExtension

source§

impl Codec for CertificateStatusRequest

source§

impl Codec for ClientExtension

source§

impl Codec for HelloRetryExtension

source§

impl Codec for NewSessionTicketExtension

source§

impl Codec for ServerExtension

source§

impl Codec for ServerKeyExchangePayload

source§

impl Codec for Certificate

source§

impl Codec for AlertMessagePayload

source§

impl Codec for Payload

source§

impl Codec for PayloadU8

source§

impl Codec for PayloadU16

source§

impl Codec for PayloadU24

source§

impl Codec for ChangeCipherSpecPayload

source§

impl Codec for CertificateEntry

source§

impl Codec for CertificatePayloadTLS13

source§

impl Codec for CertificateRequestPayload

source§

impl Codec for CertificateRequestPayloadTLS13

source§

impl Codec for CertificateStatus

source§

impl Codec for ClientECDHParams

source§

impl Codec for ClientHelloPayload

source§

impl Codec for DigitallySignedStruct

source§

impl Codec for ECDHEServerKeyExchange

source§

impl Codec for ECParameters

source§

impl Codec for HandshakeMessagePayload

source§

impl Codec for HelloRetryRequest

source§

impl Codec for KeyShareEntry

source§

impl Codec for NewSessionTicketPayload

source§

impl Codec for NewSessionTicketPayloadTLS13

source§

impl Codec for OCSPCertificateStatusRequest

source§

impl Codec for PresharedKeyIdentity

source§

impl Codec for PresharedKeyOffer

source§

impl Codec for Random

source§

impl Codec for ServerECDHParams

source§

impl Codec for ServerHelloPayload

source§

impl Codec for ServerName

source§

impl Codec for SessionID

source§

impl Codec for ClientSessionKey

source§

impl Codec for ServerSessionValue

source§

impl Codec for u24

source§

impl Codec for CertReqExtensions

source§

impl Codec for CertificateExtensions

source§

impl Codec for CertificatePayload

source§

impl Codec for ClientCertificateTypes

source§

impl Codec for ECPointFormatList

source§

impl Codec for EncryptedExtensions

source§

impl Codec for KeyShareEntries

source§

impl Codec for NamedGroups

source§

impl Codec for NewSessionTicketExtensions

source§

impl Codec for PSKKeyExchangeModes

source§

impl Codec for PresharedKeyIdentities

source§

impl Codec for ProtocolVersions

source§

impl Codec for ServerNameRequest

source§

impl Codec for SupportedSignatureSchemes

source§

impl Codec for VecU16OfPayloadU8

source§

impl Codec for VecU16OfPayloadU16