[−][src]Struct picky_asn1_der::Asn1RawDer
User-provided raw DER wrapper.
Allow user to provide raw DER: no tag is added by serializer and bytes are bumped as it. Note that provided DER header has to be valid to determine length on deserialization.
Example
use picky_asn1_der::Asn1RawDer; use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, PartialEq, Debug)] struct A { number: u8, user_provided: Asn1RawDer, } let plain_a = A { number: 7, user_provided: Asn1RawDer(vec![ 0x30, 0x08, 0x0C, 0x03, 0x41, 0x62, 0x63, 0x02, 0x01, 0x05, ]), }; let serialized_a = picky_asn1_der::to_vec(&plain_a).expect("A to vec"); assert_eq!( serialized_a, [ 0x30, 0x0D, 0x02, 0x01, 0x07, 0x30, 0x08, 0x0C, 0x03, 0x41, 0x62, 0x63, 0x02, 0x01, 0x05, ] ); let deserialized_a = picky_asn1_der::from_bytes(&serialized_a).expect("A from bytes"); assert_eq!(plain_a, deserialized_a); // we can deserialize into a compatible B structure. #[derive(Deserialize, Debug, PartialEq)] struct B { number: u8, tuple: (String, u8), } let plain_b = B { number: 7, tuple: ("Abc".to_owned(), 5) }; let deserialized_b: B = picky_asn1_der::from_bytes(&serialized_a).expect("B from bytes"); assert_eq!(deserialized_b, plain_b);
Methods
impl Asn1RawDer
[src]
Trait Implementations
impl Clone for Asn1RawDer
[src]
fn clone(&self) -> Asn1RawDer
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Asn1RawDer
[src]
impl<'de> Deserialize<'de> for Asn1RawDer
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Hash for Asn1RawDer
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Asn1RawDer> for Asn1RawDer
[src]
fn eq(&self, other: &Asn1RawDer) -> bool
[src]
fn ne(&self, other: &Asn1RawDer) -> bool
[src]
impl PartialOrd<Asn1RawDer> for Asn1RawDer
[src]
fn partial_cmp(&self, other: &Asn1RawDer) -> Option<Ordering>
[src]
fn lt(&self, other: &Asn1RawDer) -> bool
[src]
fn le(&self, other: &Asn1RawDer) -> bool
[src]
fn gt(&self, other: &Asn1RawDer) -> bool
[src]
fn ge(&self, other: &Asn1RawDer) -> bool
[src]
impl Serialize for Asn1RawDer
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralPartialEq for Asn1RawDer
[src]
Auto Trait Implementations
impl RefUnwindSafe for Asn1RawDer
impl Send for Asn1RawDer
impl Sync for Asn1RawDer
impl Unpin for Asn1RawDer
impl UnwindSafe for Asn1RawDer
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,