pub struct HeaderOnly<T: Asn1Type>(pub PhantomData<T>);
Expand description
A wrapper encoding/decoding only the header of the provided Asn1Wrapper with a length of 0.
Examples:
use picky_asn1::wrapper::{ExplicitContextTag0, HeaderOnly};
use serde::{Serialize, Deserialize};
let tag_only = HeaderOnly::<ExplicitContextTag0<()>>::default();
let buffer = [0xA0, 0x00];
let encoded = picky_asn1_der::to_vec(&tag_only).expect("couldn't serialize");
assert_eq!(
encoded,
buffer,
);
let decoded: HeaderOnly<ExplicitContextTag0<()>> = picky_asn1_der::from_bytes(&buffer).expect("couldn't deserialize");
assert_eq!(
decoded,
tag_only,
);
Tuple Fields§
§0: PhantomData<T>
Trait Implementations§
Source§impl<T: Asn1Type> Asn1Type for HeaderOnly<T>
impl<T: Asn1Type> Asn1Type for HeaderOnly<T>
Source§impl<T: Clone + Asn1Type> Clone for HeaderOnly<T>
impl<T: Clone + Asn1Type> Clone for HeaderOnly<T>
Source§fn clone(&self) -> HeaderOnly<T>
fn clone(&self) -> HeaderOnly<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T: Default + Asn1Type> Default for HeaderOnly<T>
impl<T: Default + Asn1Type> Default for HeaderOnly<T>
Source§fn default() -> HeaderOnly<T>
fn default() -> HeaderOnly<T>
Returns the “default value” for a type. Read more
Source§impl<'de, T> Deserialize<'de> for HeaderOnly<T>where
T: Asn1Type,
impl<'de, T> Deserialize<'de> for HeaderOnly<T>where
T: Asn1Type,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T: PartialOrd + Asn1Type> PartialOrd for HeaderOnly<T>
impl<T: PartialOrd + Asn1Type> PartialOrd for HeaderOnly<T>
Source§impl<T> Serialize for HeaderOnly<T>where
T: Asn1Type,
impl<T> Serialize for HeaderOnly<T>where
T: Asn1Type,
impl<T: Eq + Asn1Type> Eq for HeaderOnly<T>
impl<T: Asn1Type> StructuralPartialEq for HeaderOnly<T>
Auto Trait Implementations§
impl<T> Freeze for HeaderOnly<T>
impl<T> RefUnwindSafe for HeaderOnly<T>where
T: RefUnwindSafe,
impl<T> Send for HeaderOnly<T>where
T: Send,
impl<T> Sync for HeaderOnly<T>where
T: Sync,
impl<T> Unpin for HeaderOnly<T>where
T: Unpin,
impl<T> UnwindSafe for HeaderOnly<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more