Skip to main content

generate_with_config

Function generate_with_config 

Source
pub fn generate_with_config(
    module: &Module,
    config: CodeGenConfig,
) -> Result<String, Error>
Expand description

Generate Rust code from an ASN.1 module with custom configuration.

§Configuration options

  • string_type_mode — choose between owned heap-allocating types (OctetString, BitString, …) and zero-copy borrowed types (OctetStringRef<'a>, BitStringRef<'a>, …). See StringTypeMode.
  • module_path_prefix — emit use <prefix>::<module>::Type; statements instead of comment-only import annotations. See CodeGenConfig::with_crate_imports, CodeGenConfig::with_super_imports, CodeGenConfig::with_custom_prefix.
  • use_core — emit core::convert::TryFrom instead of std::convert::TryFrom for #![no_std] environments.
  • skip_imported_types / imported_type_lifetimes — fine-grained control over which imported types are emitted and which carry a lifetime.