pub struct JsCodegen { /* private fields */ }Expand description
JavaScript code generator for ELO expressions.
Implementations§
Source§impl JsCodegen
impl JsCodegen
Sourcepub fn emit_validator(&self, type_name: &str, expression: &str) -> String
pub fn emit_validator(&self, type_name: &str, expression: &str) -> String
Emit a JavaScript validator function for a single type + expression.
Returns a self-contained ES module export function validate_<Type>(data).
Sourcepub fn emit_module(&self, validators: &[(&str, &str)]) -> String
pub fn emit_module(&self, validators: &[(&str, &str)]) -> String
Emit a JavaScript module with validators for multiple types.
Each entry is (type_name, elo_expression).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for JsCodegen
impl RefUnwindSafe for JsCodegen
impl Send for JsCodegen
impl Sync for JsCodegen
impl Unpin for JsCodegen
impl UnsafeUnpin for JsCodegen
impl UnwindSafe for JsCodegen
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