pub struct JsModule {
pub functions: Vec<JsFunction>,
pub preamble: Vec<String>,
pub exports: Vec<String>,
}Expand description
A JavaScript ES2020 module, containing functions and a preamble.
Fields§
§functions: Vec<JsFunction>Top-level function declarations.
preamble: Vec<String>Top-level const/let lines (preamble, runtime, etc.).
exports: Vec<String>Names to include in the default export object.
Implementations§
Source§impl JsModule
impl JsModule
Sourcepub fn add_function(&mut self, f: JsFunction)
pub fn add_function(&mut self, f: JsFunction)
Add a function to the module.
Sourcepub fn add_preamble(&mut self, line: String)
pub fn add_preamble(&mut self, line: String)
Add a top-level preamble line (raw JS text).
Sourcepub fn add_export(&mut self, name: String)
pub fn add_export(&mut self, name: String)
Add a name to the export list.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for JsModule
impl RefUnwindSafe for JsModule
impl Send for JsModule
impl Sync for JsModule
impl Unpin for JsModule
impl UnsafeUnpin for JsModule
impl UnwindSafe for JsModule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more