summaryrefslogtreecommitdiffstats
path: root/vendor/der/src/asn1/oid.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/der/src/asn1/oid.rs
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.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/oid.rs')
-rw-r--r--vendor/der/src/asn1/oid.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/vendor/der/src/asn1/oid.rs b/vendor/der/src/asn1/oid.rs
index 8b287183d..3daa452b2 100644
--- a/vendor/der/src/asn1/oid.rs
+++ b/vendor/der/src/asn1/oid.rs
@@ -6,6 +6,9 @@ use crate::{
};
use const_oid::ObjectIdentifier;
+#[cfg(feature = "alloc")]
+use super::Any;
+
impl<'a> DecodeValue<'a> for ObjectIdentifier {
fn decode_value<R: Reader<'a>>(reader: &mut R, header: Header) -> Result<Self> {
let mut buf = [0u8; ObjectIdentifier::MAX_SIZE];
@@ -24,7 +27,7 @@ impl EncodeValue for ObjectIdentifier {
Length::try_from(self.as_bytes().len())
}
- fn encode_value(&self, writer: &mut dyn Writer) -> Result<()> {
+ fn encode_value(&self, writer: &mut impl Writer) -> Result<()> {
writer.write(self.as_bytes())
}
}
@@ -50,6 +53,13 @@ impl<'a> From<&'a ObjectIdentifier> for AnyRef<'a> {
}
}
+#[cfg(feature = "alloc")]
+impl From<ObjectIdentifier> for Any {
+ fn from(oid: ObjectIdentifier) -> Any {
+ AnyRef::from(&oid).into()
+ }
+}
+
impl TryFrom<AnyRef<'_>> for ObjectIdentifier {
type Error = Error;