pub struct BitStringAsn1Container<Encapsulated>(pub Encapsulated);
Expand description
A BitString encapsulating things.
Same as OctetStringAsn1Container
but using a BitString instead.
Useful to perform a full serialization / deserialization in one pass
instead of using BitStringAsn1
manually.
Examples
use picky_asn1::wrapper::BitStringAsn1Container;
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug, PartialEq)]
struct MyType {
a: u32,
b: u16,
c: u16,
}
type MyTypeEncapsulated = BitStringAsn1Container<MyType>;
let encapsulated: MyTypeEncapsulated = MyType {
a: 83910,
b: 3839,
c: 4023,
}.into();
let buffer = [
0x03, 0x10, 0x00, // bit 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 BitStringAsn1Container<Encapsulated>
impl<Encapsulated> Asn1Type for BitStringAsn1Container<Encapsulated>
Source§impl<Encapsulated: Clone> Clone for BitStringAsn1Container<Encapsulated>
impl<Encapsulated: Clone> Clone for BitStringAsn1Container<Encapsulated>
Source§fn clone(&self) -> BitStringAsn1Container<Encapsulated>
fn clone(&self) -> BitStringAsn1Container<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 BitStringAsn1Container<Encapsulated>
impl<Encapsulated: Debug> Debug for BitStringAsn1Container<Encapsulated>
Source§impl<Encapsulated> Default for BitStringAsn1Container<Encapsulated>where
Encapsulated: Default,
impl<Encapsulated> Default for BitStringAsn1Container<Encapsulated>where
Encapsulated: Default,
Source§impl<Encapsulated> Deref for BitStringAsn1Container<Encapsulated>
impl<Encapsulated> Deref for BitStringAsn1Container<Encapsulated>
Source§impl<Encapsulated> DerefMut for BitStringAsn1Container<Encapsulated>
impl<Encapsulated> DerefMut for BitStringAsn1Container<Encapsulated>
Source§impl<'de, Encapsulated> Deserialize<'de> for BitStringAsn1Container<Encapsulated>where
Encapsulated: Deserialize<'de>,
impl<'de, Encapsulated> Deserialize<'de> for BitStringAsn1Container<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 BitStringAsn1Container<Encapsulated>
impl<Encapsulated> From<Encapsulated> for BitStringAsn1Container<Encapsulated>
Source§impl<Encapsulated: Hash> Hash for BitStringAsn1Container<Encapsulated>
impl<Encapsulated: Hash> Hash for BitStringAsn1Container<Encapsulated>
Source§impl<Encapsulated> PartialEq<Encapsulated> for BitStringAsn1Container<Encapsulated>where
Encapsulated: PartialEq,
impl<Encapsulated> PartialEq<Encapsulated> for BitStringAsn1Container<Encapsulated>where
Encapsulated: PartialEq,
Source§impl<Encapsulated: PartialEq> PartialEq for BitStringAsn1Container<Encapsulated>
impl<Encapsulated: PartialEq> PartialEq for BitStringAsn1Container<Encapsulated>
Source§fn eq(&self, other: &BitStringAsn1Container<Encapsulated>) -> bool
fn eq(&self, other: &BitStringAsn1Container<Encapsulated>) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.Source§impl<Encapsulated: PartialOrd> PartialOrd for BitStringAsn1Container<Encapsulated>
impl<Encapsulated: PartialOrd> PartialOrd for BitStringAsn1Container<Encapsulated>
Source§impl<Encapsulated> Serialize for BitStringAsn1Container<Encapsulated>where
Encapsulated: Serialize,
impl<Encapsulated> Serialize for BitStringAsn1Container<Encapsulated>where
Encapsulated: Serialize,
impl<Encapsulated: Eq> Eq for BitStringAsn1Container<Encapsulated>
impl<Encapsulated> StructuralPartialEq for BitStringAsn1Container<Encapsulated>
Auto Trait Implementations§
impl<Encapsulated> Freeze for BitStringAsn1Container<Encapsulated>where
Encapsulated: Freeze,
impl<Encapsulated> RefUnwindSafe for BitStringAsn1Container<Encapsulated>where
Encapsulated: RefUnwindSafe,
impl<Encapsulated> Send for BitStringAsn1Container<Encapsulated>where
Encapsulated: Send,
impl<Encapsulated> Sync for BitStringAsn1Container<Encapsulated>where
Encapsulated: Sync,
impl<Encapsulated> Unpin for BitStringAsn1Container<Encapsulated>where
Encapsulated: Unpin,
impl<Encapsulated> UnwindSafe for BitStringAsn1Container<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