[−][src]Module genco::lang::js
Specialization for JavaScript code generation.
Examples
Basic example:
use genco::prelude::*; let toks: js::Tokens = quote! { function foo(v) { return v + ", World"; } foo("Hello"); }; assert_eq!( vec![ "function foo(v) {", " return v + \", World\";", "}", "", "foo(\"Hello\");", ], toks.to_file_vec()? );
String quoting in JavaScript:
use genco::prelude::*; let toks: js::Tokens = quote!("hello \n world"); assert_eq!("\"hello \\n world\"", toks.to_string()?); let toks: js::Tokens = quote!(#(quoted("hello \n world"))); assert_eq!("\"hello \\n world\"", toks.to_string()?);
Structs
Config | Configuration for JavaScript. |
Format | Format state for JavaScript. |
Import | An imported JavaScript item |
JavaScript | JavaScript language specialization. |
Enums
Any | Enum produced by AsAny::as_any() which can be used to identify and operate over a discrete language item type. |
Module | A module being imported. |
Traits
AsAny | Language-specific conversion trait implemented by all language items. |
Functions
import | Import an element from a module |
Type Definitions
Tokens | Tokens container specialization for Rust. |