Struct quickjs_rs::ContextBuilder
source · pub struct ContextBuilder { /* private fields */ }
Expand description
A builder for Context.
Create with Context::builder.
Implementations§
source§impl ContextBuilder
impl ContextBuilder
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.
Auto Trait Implementations§
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