[−][src]Module genco::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().unwrap() );
String quoting in JavaScript:
use genco::prelude::*; let toks: js::Tokens = quote!(#("hello \n world".quoted())); assert_eq!("\"hello \\n world\"", toks.to_string().unwrap());
Structs
Import | An imported item in JavaScript. |
ImportDefault | The default imported item. |
JavaScript | JavaScript language specialization. |
Local | A local name. |
TypeBox | Boxed type container |
Enums
TypeEnum | Enum that can be used for casting between variants of the same type |
Traits
TypeArgs | Helper trait for things that can be turned into generic arguments. |
TypeTrait | Trait implemented by all types |
Functions
import | Import an element from a module |
import_default | Import the default element from the specified module. |
local | Setup a local element. |
Type Definitions
Tokens | Tokens container specialization for Rust. |