Crates.io | ser_der |
lib.rs | ser_der |
version | 0.1.0-alpha.1 |
source | src |
created_at | 2024-05-05 13:04:13.092383 |
updated_at | 2024-05-05 15:00:26.105159 |
description | Newtypes for the der crate to allow for serde de-/serialization |
homepage | |
repository | |
max_upload_size | |
id | 1230206 |
size | 21,193 |
Newtypes for the der crate to allow for serde de-/serialization.
Add this to your Cargo.toml
:
[dependencies]
ser_der = { version = "0", features = ["alloc"] } # Features should match the ones of the der crate
der = { version = "0", features = ["alloc"] }
serde = { version = "1", features = ["derive"] }
You can then use the newtypes offered by this crate to de-/serialize DER-encoded data structures using serde.
#[derive(serde::Serialize, serde::Deserialize)]
struct MyStruct {
#[serde(with = "ser_der::asn1::ia5_string")]
bits: ser_der::asn1::IA5String,
}
All newtypes implement Deref
, DerefMut
, From<[Newtype]> for [Type]
and From<[Type]> for [Newtype]
to the underlying der
type.
der
This crate is a temporary solution until the der
crate supports serde de-/serialization. The plan is to upstream the serde support to the der
crate.