File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,29 @@ use crate::EncodingRules;
2323///
2424/// When decoding fails, a [`Decode::Error`] type is thrown.
2525/// Most ASN.1 DER objects return a builtin der [`Error`] type as [`Decode::Error`], which can be made from [`ErrorKind`].
26+ ///
27+ /// ## Example
28+ ///
29+ /// ```
30+ /// # #[cfg(all(feature = "alloc", feature = "std"))]
31+ /// # {
32+ /// use der::{Any, Decode, Reader};
33+ ///
34+ /// /// Wrapper around Any, with custom foreign trait support.
35+ /// ///
36+ /// /// For example: serde Serialize/Deserialize
37+ /// pub struct AnySerde(pub Any);
38+ ///
39+ /// impl<'a> Decode<'a> for AnySerde {
40+ /// type Error = der::Error;
41+ ///
42+ /// fn decode<R: Reader<'a>>(reader: &mut R) -> der::Result<Self> {
43+ /// // calls impl Decode for Any
44+ /// Ok(Self(Any::decode(reader)?))
45+ /// }
46+ /// }
47+ /// # }
48+ /// ```
2649#[ diagnostic:: on_unimplemented(
2750 note = "Consider adding impls of `DecodeValue` and `FixedTag` to `{Self}`"
2851) ]
You can’t perform that action at this time.
0 commit comments