wtx 0.45.0

A collection of different transport implementations and related tools focused primarily on web technologies.
Documentation
use crate::{
  asn1::{Asn1DecodeWrapper, Asn1EncodeWrapper, Len, SEQUENCE_TAG, SequenceBuffer},
  codec::{Decode, DecodeWrapper, Encode, EncodeWrapper, GenericCodec},
  collection::Vector,
  x509::RevokedCertificate,
};

/// List of revoked certificates
#[derive(Debug, PartialEq)]
pub struct RevokedCertificates<'bytes>(
  /// List of revoked certificates
  pub Vector<RevokedCertificate<'bytes>>,
);

impl<'de> Decode<'de, GenericCodec<Asn1DecodeWrapper, ()>> for RevokedCertificates<'de> {
  #[inline]
  fn decode(dw: &mut DecodeWrapper<'de, Asn1DecodeWrapper>) -> crate::Result<Self> {
    let collection = SequenceBuffer::decode(dw, SEQUENCE_TAG)?.0;
    Ok(Self(collection))
  }
}

impl<'bytes> Encode<GenericCodec<(), Asn1EncodeWrapper>> for RevokedCertificates<'bytes> {
  #[inline]
  fn encode(&self, ew: &mut EncodeWrapper<'_, Asn1EncodeWrapper>) -> crate::Result<()> {
    SequenceBuffer(&self.0).encode(ew, Len::MAX_THREE_BYTES, SEQUENCE_TAG)
  }
}