pub struct DerError { /* private fields */ }Expand description
Opaque wrapper around an underlying ASN.1 / DER error.
Carries a Display message identical to the wrapped der::Error so
diagnostic output is preserved, but does not expose the underlying type
in the public API. This insulates callers from semver-breaking changes
in the der crate’s error variants.
Construct via DerError::new (or implicitly via
[From<der::Error> for Error]). Sibling workspace crates that wrap
DER decoding failures in their own Error enums (pkix-revocation,
pkix-truststore) call DerError::new directly.
§Serde wire form
When the serde feature is enabled, DerError (de)serializes via its
Display message as a single String field. Because der::Error does
not itself carry a textual message — its Display is derived from
der::ErrorKind — round-trip is lossy: a deserialized DerError
preserves the original Display output verbatim but its
std::error::Error::source is None because the original
der::Error value cannot be reconstructed from a free-form string.
This trade is acceptable for diagnostic error types; the success type
(ValidatedPath) round-trips losslessly because all its fields are
canonically DER-encodable.
Implementations§
Source§impl DerError
impl DerError
Sourcepub fn new(e: Error) -> Self
pub fn new(e: Error) -> Self
Construct a DerError from a real der::Error.
The original der::Error is preserved internally so
std::error::Error::source returns it; the rendered
Display message is cached so the diagnostic survives serde
round-trips. See the type-level rustdoc for the round-trip
fidelity contract.
Exposed to permit sibling workspace crates (pkix-revocation,
pkix-truststore) to construct their own Error::Der-equivalent
variants from der::Error results without going through the
pkix_path::Error::from(der::Error) conversion (which would
produce a pkix_path::Error, not the sibling crate’s Error).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DerError
Available on crate feature serde only.
impl<'de> Deserialize<'de> for DerError
serde only.Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
impl Eq for DerError
Source§impl Error for DerError
Available on crate feature std only.
impl Error for DerError
std only.Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()