Struct picky_asn1::wrapper::OctetStringAsn1Container
source · pub struct OctetStringAsn1Container<Encapsulated>(pub Encapsulated);
Expand description
An OctetString encapsulating things.
Same as BitStringAsn1Container
but using an OctetString instead.
Useful to perform a full serialization / deserialization in one pass
instead of using OctetStringAsn1
manually.
Examples
use picky_asn1::wrapper::OctetStringAsn1Container;
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug, PartialEq)]
struct MyType {
a: u32,
b: u16,
c: u16,
}
type MyTypeEncapsulated = OctetStringAsn1Container<MyType>;
let encapsulated: MyTypeEncapsulated = MyType {
a: 83910,
b: 3839,
c: 4023,
}.into();
let buffer = [
0x04, 0x0F, // octet string part
0x30, 0x0d, // sequence
0x02, 0x03, 0x01, 0x47, 0xc6, // integer a
0x02, 0x02, 0x0e, 0xff, // integer b
0x02, 0x02, 0x0f, 0xb7, // integer c
];
let encoded = picky_asn1_der::to_vec(&encapsulated).expect("couldn't serialize");
assert_eq!(
encoded,
buffer,
);
let decoded: MyTypeEncapsulated = picky_asn1_der::from_bytes(&buffer).expect("couldn't deserialize");
assert_eq!(
decoded,
encapsulated,
);
Tuple Fields§
§0: Encapsulated
Trait Implementations§
source§impl<Encapsulated> Asn1Type for OctetStringAsn1Container<Encapsulated>
impl<Encapsulated> Asn1Type for OctetStringAsn1Container<Encapsulated>
source§impl<Encapsulated: Clone> Clone for OctetStringAsn1Container<Encapsulated>
impl<Encapsulated: Clone> Clone for OctetStringAsn1Container<Encapsulated>
source§fn clone(&self) -> OctetStringAsn1Container<Encapsulated>
fn clone(&self) -> OctetStringAsn1Container<Encapsulated>
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<Encapsulated: Debug> Debug for OctetStringAsn1Container<Encapsulated>
impl<Encapsulated: Debug> Debug for OctetStringAsn1Container<Encapsulated>
source§impl<Encapsulated> Default for OctetStringAsn1Container<Encapsulated>where
Encapsulated: Default,
impl<Encapsulated> Default for OctetStringAsn1Container<Encapsulated>where
Encapsulated: Default,
source§impl<Encapsulated> Deref for OctetStringAsn1Container<Encapsulated>
impl<Encapsulated> Deref for OctetStringAsn1Container<Encapsulated>
source§impl<Encapsulated> DerefMut for OctetStringAsn1Container<Encapsulated>
impl<Encapsulated> DerefMut for OctetStringAsn1Container<Encapsulated>
source§impl<'de, Encapsulated> Deserialize<'de> for OctetStringAsn1Container<Encapsulated>where
Encapsulated: Deserialize<'de>,
impl<'de, Encapsulated> Deserialize<'de> for OctetStringAsn1Container<Encapsulated>where
Encapsulated: Deserialize<'de>,
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<Encapsulated> From<Encapsulated> for OctetStringAsn1Container<Encapsulated>
impl<Encapsulated> From<Encapsulated> for OctetStringAsn1Container<Encapsulated>
source§impl<Encapsulated: Hash> Hash for OctetStringAsn1Container<Encapsulated>
impl<Encapsulated: Hash> Hash for OctetStringAsn1Container<Encapsulated>
source§impl<Encapsulated> PartialEq<Encapsulated> for OctetStringAsn1Container<Encapsulated>where
Encapsulated: PartialEq,
impl<Encapsulated> PartialEq<Encapsulated> for OctetStringAsn1Container<Encapsulated>where
Encapsulated: PartialEq,
source§fn eq(&self, other: &Encapsulated) -> bool
fn eq(&self, other: &Encapsulated) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<Encapsulated: PartialEq> PartialEq for OctetStringAsn1Container<Encapsulated>
impl<Encapsulated: PartialEq> PartialEq for OctetStringAsn1Container<Encapsulated>
source§fn eq(&self, other: &OctetStringAsn1Container<Encapsulated>) -> bool
fn eq(&self, other: &OctetStringAsn1Container<Encapsulated>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<Encapsulated: PartialOrd> PartialOrd for OctetStringAsn1Container<Encapsulated>
impl<Encapsulated: PartialOrd> PartialOrd for OctetStringAsn1Container<Encapsulated>
source§fn partial_cmp(
&self,
other: &OctetStringAsn1Container<Encapsulated>,
) -> Option<Ordering>
fn partial_cmp( &self, other: &OctetStringAsn1Container<Encapsulated>, ) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<Encapsulated> Serialize for OctetStringAsn1Container<Encapsulated>where
Encapsulated: Serialize,
impl<Encapsulated> Serialize for OctetStringAsn1Container<Encapsulated>where
Encapsulated: Serialize,
impl<Encapsulated: Eq> Eq for OctetStringAsn1Container<Encapsulated>
impl<Encapsulated> StructuralPartialEq for OctetStringAsn1Container<Encapsulated>
Auto Trait Implementations§
impl<Encapsulated> Freeze for OctetStringAsn1Container<Encapsulated>where
Encapsulated: Freeze,
impl<Encapsulated> RefUnwindSafe for OctetStringAsn1Container<Encapsulated>where
Encapsulated: RefUnwindSafe,
impl<Encapsulated> Send for OctetStringAsn1Container<Encapsulated>where
Encapsulated: Send,
impl<Encapsulated> Sync for OctetStringAsn1Container<Encapsulated>where
Encapsulated: Sync,
impl<Encapsulated> Unpin for OctetStringAsn1Container<Encapsulated>where
Encapsulated: Unpin,
impl<Encapsulated> UnwindSafe for OctetStringAsn1Container<Encapsulated>where
Encapsulated: 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)