diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:42 +0000 |
commit | 837b550238aa671a591ccf282dddeab29cadb206 (patch) | |
tree | 914b6b8862bace72bd3245ca184d374b08d8a672 /vendor/der/src/asn1/null.rs | |
parent | Adding debian version 1.70.0+dfsg2-1. (diff) | |
download | rustc-837b550238aa671a591ccf282dddeab29cadb206.tar.xz rustc-837b550238aa671a591ccf282dddeab29cadb206.zip |
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/der/src/asn1/null.rs')
-rw-r--r-- | vendor/der/src/asn1/null.rs | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/vendor/der/src/asn1/null.rs b/vendor/der/src/asn1/null.rs index e87729f18..7c1e2058a 100644 --- a/vendor/der/src/asn1/null.rs +++ b/vendor/der/src/asn1/null.rs @@ -1,7 +1,7 @@ //! ASN.1 `NULL` support. use crate::{ - asn1::AnyRef, ord::OrdIsValueOrd, ByteSlice, DecodeValue, EncodeValue, Error, ErrorKind, + asn1::AnyRef, ord::OrdIsValueOrd, BytesRef, DecodeValue, EncodeValue, Error, ErrorKind, FixedTag, Header, Length, Reader, Result, Tag, Writer, }; @@ -9,6 +9,8 @@ use crate::{ #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] pub struct Null; +impl_any_conversions!(Null); + impl<'a> DecodeValue<'a> for Null { fn decode_value<R: Reader<'a>>(reader: &mut R, header: Header) -> Result<Self> { if header.length.is_zero() { @@ -24,7 +26,7 @@ impl EncodeValue for Null { Ok(Length::ZERO) } - fn encode_value(&self, _writer: &mut dyn Writer) -> Result<()> { + fn encode_value(&self, _writer: &mut impl Writer) -> Result<()> { Ok(()) } } @@ -37,15 +39,7 @@ impl OrdIsValueOrd for Null {} impl<'a> From<Null> for AnyRef<'a> { fn from(_: Null) -> AnyRef<'a> { - AnyRef::from_tag_and_value(Tag::Null, ByteSlice::default()) - } -} - -impl TryFrom<AnyRef<'_>> for Null { - type Error = Error; - - fn try_from(any: AnyRef<'_>) -> Result<Null> { - any.decode_into() + AnyRef::from_tag_and_value(Tag::Null, BytesRef::default()) } } @@ -75,7 +69,7 @@ impl EncodeValue for () { Ok(Length::ZERO) } - fn encode_value(&self, _writer: &mut dyn Writer) -> Result<()> { + fn encode_value(&self, _writer: &mut impl Writer) -> Result<()> { Ok(()) } } |