pub struct ContextBuilder { /* private fields */ }
Expand description
A builder for Context.
Create with Context::builder.
Implementations§
Source§impl ContextBuilder
impl ContextBuilder
pub fn new() -> Self
Sourcepub fn memory_limit(self, max_bytes: usize) -> Self
pub fn memory_limit(self, max_bytes: usize) -> Self
Sets the memory limit of the Javascript runtime (in bytes).
If the limit is exceeded, methods like eval
will return
a Err(ExecutionError::Exception(JsValue::Null))
Sourcepub fn console<B>(self, backend: B) -> Selfwhere
B: ConsoleBackend,
pub fn console<B>(self, backend: B) -> Selfwhere
B: ConsoleBackend,
Set a console handler that will proxy console.{log,trace,debug,...}
calls.
The given argument must implement the console::ConsoleBackend trait.
A very simple logger could look like this:
Sourcepub fn build(self) -> Result<Context, ContextError>
pub fn build(self) -> Result<Context, ContextError>
Finalize the builder and build a JS Context.
Trait Implementations§
Source§impl Default for ContextBuilder
impl Default for ContextBuilder
Source§fn default() -> ContextBuilder
fn default() -> ContextBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ContextBuilder
impl RefUnwindSafe for ContextBuilder
impl !Send for ContextBuilder
impl !Sync for ContextBuilder
impl Unpin for ContextBuilder
impl !UnwindSafe for ContextBuilder
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