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<'_>) -> Result<Self, InvalidMessage>;

    // Provided methods
    fn get_encoding(&self) -> Vec<u8>  { ... }
    fn read_bytes(bytes: &[u8]) -> Result<Self, InvalidMessage> { ... }
}
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<'_>) -> Result<Self, InvalidMessage>

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]) -> Result<Self, InvalidMessage>

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

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Codec for u8

source§

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

source§

fn read(r: &mut Reader<'_>) -> Result<Self, InvalidMessage>

source§

impl Codec for u16

source§

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

source§

fn read(r: &mut Reader<'_>) -> Result<Self, InvalidMessage>

source§

impl Codec for u32

source§

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

source§

fn read(r: &mut Reader<'_>) -> Result<Self, InvalidMessage>

source§

impl Codec for u64

source§

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

source§

fn read(r: &mut Reader<'_>) -> Result<Self, InvalidMessage>

source§

impl<T: Codec + TlsListElement + Debug> Codec for Vec<T>

Implement Codec for lists of elements that implement TlsListElement.

TlsListElement provides the size of the length prefix for the list.

source§

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

source§

fn read(r: &mut Reader<'_>) -> Result<Self, InvalidMessage>

Implementors§

source§

impl Codec for AlertDescription

source§

impl Codec for CipherSuite

source§

impl Codec for ContentType

source§

impl Codec for HandshakeType

source§

impl Codec for ProtocolVersion

source§

impl Codec for SignatureAlgorithm

source§

impl Codec for SignatureScheme

source§

impl Codec for AlertLevel

source§

impl Codec for CertificateStatusType

source§

impl Codec for ClientCertificateType

source§

impl Codec for Compression

source§

impl Codec for ECCurveType

source§

impl Codec for ECPointFormat

source§

impl Codec for ExtensionType

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 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 u24

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 DistinguishedName

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 PresharedKeyBinder

source§

impl Codec for PresharedKeyIdentity

source§

impl Codec for PresharedKeyOffer

source§

impl Codec for ProtocolName

source§

impl Codec for Random

source§

impl Codec for ResponderId

source§

impl Codec for Sct

source§

impl Codec for ServerECDHParams

source§

impl Codec for ServerHelloPayload

source§

impl Codec for ServerName

source§

impl Codec for SessionId

source§

impl Codec for ServerSessionValue

source§

impl Codec for DigitallySignedStruct