pub struct Asn1Compiler { /* private fields */ }
Expand description
ASN.1 Compiler Struct.
An application should create a Compiler Structure and will call Public API functions on the compiler.
Implementations§
Source§impl Asn1Compiler
impl Asn1Compiler
Sourcepub fn new(
output: &str,
visibility: &Visibility,
codecs: Vec<Codec>,
derives: Vec<Derive>,
) -> Self
pub fn new( output: &str, visibility: &Visibility, codecs: Vec<Codec>, derives: Vec<Derive>, ) -> Self
Create a new Instance of the Compiler structure.
Sourcepub fn add_module(&mut self, module: Asn1Module) -> bool
pub fn add_module(&mut self, module: Asn1Module) -> bool
Add a module to the list of known modules.
If the module alredy exists, returns false
else returns true
.
Sourcepub fn set_rustfmt_generated_code(&mut self, rustfmt_generated_code: bool)
pub fn set_rustfmt_generated_code(&mut self, rustfmt_generated_code: bool)
Whether to use rustfmt
to format the generated code after it is made.
§Arguments
rustfmt_generated_code
- Whether to format the generated code withrustfmt
when calling thegenerate
method. If set tofalse
,rustfmt
will not be used.
Sourcepub fn resolve_modules(&mut self) -> Result<()>
pub fn resolve_modules(&mut self) -> Result<()>
Resolve Modules order and definitions within those modules.
First Makes sure that all the modules that have IMPORTs are indeed added to us. Then
definitions in each of the modules are ‘resolved’. Calls the Resolver
functions to do
that. Modules are Topologically Sorted before they are resolved and definitions within
modules are topologically sorted as well. This makes Error handling for undefined
definitions much easier.