diff --git a/README.md b/README.md index 982e68e..c80a423 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,10 @@ fn main() { // set an output path for the generated rust code .set_output_path(PathBuf::from("./asn/generated.rs")) // you may also compile literal ASN1 snippets - .add_asn_literal("My-test-integer ::= INTEGER (1..128)") + .add_asn_literal(format!( + "TestModule DEFINITIONS AUTOMATIC TAGS::= BEGIN {} END", + "My-test-integer ::= INTEGER (1..128)" + )) .compile() { Ok(warnings /* Vec> */) => { /* handle compilation warnings */ } Err(error /* Box */) => { /* handle unrecoverable compilation error */ } diff --git a/rasn-compiler/src/lib.rs b/rasn-compiler/src/lib.rs index c3ce164..f6259a4 100644 --- a/rasn-compiler/src/lib.rs +++ b/rasn-compiler/src/lib.rs @@ -38,7 +38,10 @@ //! // set an output path for the generated rust code //! .set_output_path(PathBuf::from("./asn/generated.rs")) //! // you may also compile literal ASN1 snippets -//! .add_asn_literal("My-test-integer ::= INTEGER (1..128)") +//! .add_asn_literal(format!( +//! "TestModule DEFINITIONS AUTOMATIC TAGS::= BEGIN {} END", +//! "My-test-integer ::= INTEGER (1..128)" +//! )) //! .compile() { //! Ok(warnings /* Vec> */) => { /* handle compilation warnings */ } //! Err(error /* Box */) => { /* handle unrecoverable compilation error */ } @@ -235,7 +238,10 @@ impl Compiler { /// * `literal` - literal ASN1 statement to include /// ```rust /// # use rasn_compiler::Compiler; - /// Compiler::new().add_asn_literal("My-test-integer ::= INTEGER (1..128)").compile_to_string(); + /// Compiler::new().add_asn_literal(format!( + /// "TestModule DEFINITIONS AUTOMATIC TAGS::= BEGIN {} END", + /// "My-test-integer ::= INTEGER (1..128)" + /// )).compile_to_string(); /// ``` pub fn add_asn_literal(self, literal: impl Into) -> Compiler { Compiler { @@ -298,7 +304,10 @@ impl Compiler { /// * `literal` - literal ASN1 statement to include /// ```rust /// # use rasn_compiler::Compiler; - /// Compiler::new().add_asn_literal("My-test-integer ::= INTEGER (1..128)").compile_to_string(); + /// Compiler::new().add_asn_literal(format!( + /// "TestModule DEFINITIONS AUTOMATIC TAGS::= BEGIN {} END", + /// "My-test-integer ::= INTEGER (1..128)" + /// )).compile_to_string(); /// ``` pub fn add_asn_literal(self, literal: impl Into) -> Compiler { Compiler { @@ -344,7 +353,10 @@ impl Compiler { /// * `literal` - literal ASN1 statement to include /// ```rust /// # use rasn_compiler::Compiler; - /// Compiler::new().add_asn_literal("My-test-integer ::= INTEGER (1..128)").compile_to_string(); + /// Compiler::new().add_asn_literal(format!( + /// "TestModule DEFINITIONS AUTOMATIC TAGS::= BEGIN {} END", + /// "My-test-integer ::= INTEGER (1..128)" + /// )).compile_to_string(); /// ``` pub fn add_asn_literal(self, literal: impl Into) -> Compiler { let mut sources: Vec = self.state.sources; @@ -470,7 +482,10 @@ impl Compiler { /// * `literal` - literal ASN1 statement to include /// ```rust /// # use rasn_compiler::Compiler; - /// Compiler::new().add_asn_literal("My-test-integer ::= INTEGER (1..128)").compile_to_string(); + /// Compiler::new().add_asn_literal(format!( + /// "TestModule DEFINITIONS AUTOMATIC TAGS::= BEGIN {} END", + /// "My-test-integer ::= INTEGER (1..128)" + /// )).compile_to_string(); /// ``` pub fn add_asn_literal(self, literal: impl Into) -> Compiler { let mut sources: Vec = self.state.sources;