pub enum DeriveMode {
FeatureGated,
Always,
Custom(String),
}Expand description
Controls how derive macros for ASN.1 types are emitted in generated code.
The generated code uses synta_derive proc-macros (Asn1Sequence,
Asn1Choice, Asn1Set) as well as helper attributes (asn1(tag(…)),
asn1(optional), asn1(rawder)). By default these are wrapped in
#[cfg_attr(feature = "derive", …)] so that the consuming crate can make
synta-derive an optional dependency. Third-party crates that always
depend on synta-derive can use DeriveMode::Always to emit the
attributes unconditionally, removing the need to declare a derive
Cargo feature.
Variants§
FeatureGated
Emit #[cfg_attr(feature = "derive", derive(Asn1Sequence))] (default).
Derive macros and their helper attributes are gated behind a derive
Cargo feature. The consuming crate must declare
[features] derive = ["dep:synta-derive"] (or similar) in its
Cargo.toml.
Always
Emit #[derive(Asn1Sequence)] unconditionally — no feature gate.
Use this when the consuming crate always depends on synta-derive
and does not want to expose a derive Cargo feature.
Custom(String)
Emit #[cfg_attr(feature = "<name>", derive(Asn1Sequence))] with a
custom feature name instead of "derive".
Useful when the consuming crate exposes its own feature name for
derive support (e.g. "asn1-derive" or "full").
Trait Implementations§
Source§impl Clone for DeriveMode
impl Clone for DeriveMode
Source§fn clone(&self) -> DeriveMode
fn clone(&self) -> DeriveMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DeriveMode
impl Debug for DeriveMode
Source§impl Default for DeriveMode
impl Default for DeriveMode
Source§fn default() -> DeriveMode
fn default() -> DeriveMode
impl Eq for DeriveMode
Source§impl PartialEq for DeriveMode
impl PartialEq for DeriveMode
Source§fn eq(&self, other: &DeriveMode) -> bool
fn eq(&self, other: &DeriveMode) -> bool
self and other values to be equal, and is used by ==.