pub struct Compiler<B: Backend, S: CompilerState> { /* private fields */ }
Expand description
The rasn compiler
Implementations§
source§impl<B: Backend, S: CompilerState> Compiler<B, S>
impl<B: Backend, S: CompilerState> Compiler<B, S>
pub fn with_backend<B2: Backend>(self, backend: B2) -> Compiler<B2, S>
source§impl<B: Backend> Compiler<B, CompilerMissingParams>
impl<B: Backend> Compiler<B, CompilerMissingParams>
sourcepub fn new() -> Compiler<B, CompilerMissingParams>
pub fn new() -> Compiler<B, CompilerMissingParams>
Provides a Builder for building rasn compiler commands
sourcepub fn new_with_config(config: B::Config) -> Compiler<B, CompilerMissingParams>
pub fn new_with_config(config: B::Config) -> Compiler<B, CompilerMissingParams>
Provides a Builder for building rasn compiler commands
source§impl<B: Backend> Compiler<B, CompilerMissingParams>
impl<B: Backend> Compiler<B, CompilerMissingParams>
sourcepub fn add_asn_by_path(
self,
path_to_source: impl Into<PathBuf>,
) -> Compiler<B, CompilerSourcesSet>
pub fn add_asn_by_path( self, path_to_source: impl Into<PathBuf>, ) -> Compiler<B, CompilerSourcesSet>
Add an ASN1 source to the compile command by path
path_to_source
- path to ASN1 file to include
sourcepub fn add_asn_sources_by_path(
self,
paths_to_sources: impl Iterator<Item = impl Into<PathBuf>>,
) -> Compiler<B, CompilerSourcesSet>
pub fn add_asn_sources_by_path( self, paths_to_sources: impl Iterator<Item = impl Into<PathBuf>>, ) -> Compiler<B, CompilerSourcesSet>
Add several ASN1 sources by path to the compile command
path_to_source
- iterator of paths to the ASN1 files to be included
sourcepub fn add_asn_literal(
self,
literal: impl Into<String>,
) -> Compiler<B, CompilerSourcesSet>
pub fn add_asn_literal( self, literal: impl Into<String>, ) -> Compiler<B, CompilerSourcesSet>
Add a literal ASN1 source to the compile command
literal
- literal ASN1 statement to include
Compiler::<RasnBackend, _>::new().add_asn_literal(format!(
"TestModule DEFINITIONS AUTOMATIC TAGS::= BEGIN {} END",
"My-test-integer ::= INTEGER (1..128)"
)).compile_to_string();
sourcepub fn set_output_path(
self,
output_path: impl Into<PathBuf>,
) -> Compiler<B, CompilerOutputSet>
pub fn set_output_path( self, output_path: impl Into<PathBuf>, ) -> Compiler<B, CompilerOutputSet>
Set the output path for the generated rust representation.
output_path
- path to an output file or directory, if path indicates a directory, the output file is namedrasn_generated.rs
source§impl<B: Backend> Compiler<B, CompilerOutputSet>
impl<B: Backend> Compiler<B, CompilerOutputSet>
sourcepub fn add_asn_by_path(
self,
path_to_source: impl Into<PathBuf>,
) -> Compiler<B, CompilerReady>
pub fn add_asn_by_path( self, path_to_source: impl Into<PathBuf>, ) -> Compiler<B, CompilerReady>
Add an ASN1 source to the compile command by path
path_to_source
- path to ASN1 file to include
sourcepub fn add_asn_sources_by_path(
self,
paths_to_sources: impl Iterator<Item = impl Into<PathBuf>>,
) -> Compiler<B, CompilerReady>
pub fn add_asn_sources_by_path( self, paths_to_sources: impl Iterator<Item = impl Into<PathBuf>>, ) -> Compiler<B, CompilerReady>
Add several ASN1 sources by path to the compile command
path_to_source
- iterator of paths to the ASN1 files to be included
sourcepub fn add_asn_literal(
self,
literal: impl Into<String>,
) -> Compiler<B, CompilerReady>
pub fn add_asn_literal( self, literal: impl Into<String>, ) -> Compiler<B, CompilerReady>
Add a literal ASN1 source to the compile command
literal
- literal ASN1 statement to include
Compiler::<RasnBackend, _>::new().add_asn_literal(format!(
"TestModule DEFINITIONS AUTOMATIC TAGS::= BEGIN {} END",
"My-test-integer ::= INTEGER (1..128)"
)).compile_to_string();
source§impl<B: Backend> Compiler<B, CompilerSourcesSet>
impl<B: Backend> Compiler<B, CompilerSourcesSet>
sourcepub fn add_asn_by_path(
self,
path_to_source: impl Into<PathBuf>,
) -> Compiler<B, CompilerSourcesSet>
pub fn add_asn_by_path( self, path_to_source: impl Into<PathBuf>, ) -> Compiler<B, CompilerSourcesSet>
Add an ASN1 source to the compile command by path
path_to_source
- path to ASN1 file to include
sourcepub fn add_asn_sources_by_path(
self,
paths_to_sources: impl Iterator<Item = impl Into<PathBuf>>,
) -> Compiler<B, CompilerSourcesSet>
pub fn add_asn_sources_by_path( self, paths_to_sources: impl Iterator<Item = impl Into<PathBuf>>, ) -> Compiler<B, CompilerSourcesSet>
Add several ASN1 sources by path to the compile command
path_to_source
- iterator of paths to the ASN1 files to be included
sourcepub fn add_asn_literal(
self,
literal: impl Into<String>,
) -> Compiler<B, CompilerSourcesSet>
pub fn add_asn_literal( self, literal: impl Into<String>, ) -> Compiler<B, CompilerSourcesSet>
Add a literal ASN1 source to the compile command
literal
- literal ASN1 statement to include
Compiler::<RasnBackend, _>::new().add_asn_literal(format!(
"TestModule DEFINITIONS AUTOMATIC TAGS::= BEGIN {} END",
"My-test-integer ::= INTEGER (1..128)"
)).compile_to_string();
sourcepub fn set_output_path(
self,
output_path: impl Into<PathBuf>,
) -> Compiler<B, CompilerReady>
pub fn set_output_path( self, output_path: impl Into<PathBuf>, ) -> Compiler<B, CompilerReady>
Set the output path for the generated rust representation.
output_path
- path to an output file or directory, if path points to a directory, the compiler will generate a file for every ASN.1 module. If the path points to a file, all modules will be written to that file.
sourcepub fn compile_to_string(self) -> Result<CompileResult, Box<dyn Error>>
pub fn compile_to_string(self) -> Result<CompileResult, Box<dyn Error>>
Runs the rasn compiler command and returns stringified Rust. Returns a Result wrapping a compilation result:
- Ok - tuple containing the stringified bindings for the ASN1 spec as well as a vector of warnings raised during the compilation
- Err - Unrecoverable error, no rust representations were generated
source§impl<B: Backend> Compiler<B, CompilerReady>
impl<B: Backend> Compiler<B, CompilerReady>
sourcepub fn add_asn_by_path(
self,
path_to_source: impl Into<PathBuf>,
) -> Compiler<B, CompilerReady>
pub fn add_asn_by_path( self, path_to_source: impl Into<PathBuf>, ) -> Compiler<B, CompilerReady>
Add an ASN1 source to the compile command by path
path_to_source
- path to ASN1 file to include
sourcepub fn add_asn_sources_by_path(
self,
paths_to_sources: impl Iterator<Item = impl Into<PathBuf>>,
) -> Compiler<B, CompilerReady>
pub fn add_asn_sources_by_path( self, paths_to_sources: impl Iterator<Item = impl Into<PathBuf>>, ) -> Compiler<B, CompilerReady>
Add several ASN1 sources by path to the compile command
path_to_source
- iterator of paths to the ASN1 files to be included
sourcepub fn add_asn_literal(
self,
literal: impl Into<String>,
) -> Compiler<B, CompilerReady>
pub fn add_asn_literal( self, literal: impl Into<String>, ) -> Compiler<B, CompilerReady>
Add a literal ASN1 source to the compile command
literal
- literal ASN1 statement to include
Compiler::<RasnBackend, _>::new().add_asn_literal(format!(
"TestModule DEFINITIONS AUTOMATIC TAGS::= BEGIN {} END",
"My-test-integer ::= INTEGER (1..128)"
)).compile_to_string();
sourcepub fn compile_to_string(self) -> Result<CompileResult, Box<dyn Error>>
pub fn compile_to_string(self) -> Result<CompileResult, Box<dyn Error>>
Runs the rasn compiler command and returns stringified Rust. Returns a Result wrapping a compilation result:
- Ok - tuple containing the stringified bindings for the ASN1 spec as well as a vector of warnings raised during the compilation
- Err - Unrecoverable error, no rust representations were generated