Skip to main content

Scope

Struct Scope 

Source
pub struct Scope<'a> { /* private fields */ }
Expand description

A host function’s view of the engine: its call, and every operation of Js. Values it hands out are handles like any other and outlive the call.

Implementations§

Source§

impl Scope<'_>

Source

pub fn this(&mut self) -> Value

The receiver: this of the call.

Source

pub fn arg(&mut self, index: usize) -> Value

Argument index; undefined past Scope::argc.

Source

pub fn argc(&self) -> usize

The number of arguments passed, whatever the function’s length.

Source

pub fn args(&mut self) -> Vec<Value>

Every argument passed.

Source

pub fn new_target(&mut self) -> Value

new.target; undefined for a call.

Source

pub fn is_construct(&self) -> bool

Whether new called the function.

Source

pub fn callee(&mut self) -> CallableRef

The function object called.

Source

pub fn data(&mut self, slot: usize) -> Value

Captured value slot (FunctionOptions::data); undefined past the last.

Source

pub fn set_data(&mut self, slot: usize, value: Value) -> JsResult<()>

Replaces captured value slot, which must exist.

Source

pub fn this_host_data<T: 'static>(&mut self) -> JsResult<Option<Rc<T>>>

The value a host object receiver holds (Js::host_data of this); None when the receiver is not a host object of T.

Source§

impl Scope<'_>

Source

pub fn throw_error( &mut self, kind: NativeErrorKind, message: &str, ) -> RuntimeError

Source§

impl Scope<'_>

Source

pub fn eval(&mut self, source: &str) -> JsResult<Value>

Compiles and runs source as a script; the completion value.

Source

pub fn eval_bytes(&mut self, source: &[u8]) -> JsResult<Value>

Source

pub fn eval_with_filename( &mut self, source: &str, filename: &str, ) -> JsResult<Value>

Source

pub fn eval_with_options( &mut self, source: &str, options: &EvalOptions, ) -> JsResult<Value>

Source

pub fn eval_bytes_with_options( &mut self, source: &[u8], options: &EvalOptions, ) -> JsResult<Value>

Source

pub fn eval_bytes_with_filename( &mut self, source: &[u8], filename: &str, ) -> JsResult<Value>

Compiles and runs source as a script named filename; the completion value. A syntax error is thrown (RuntimeError::Exception with a SyntaxError), as QuickJS’s JS_Eval does.

Source

pub fn compile(&mut self, source: &str) -> JsResult<FunctionBytecodeRef>

Source

pub fn compile_bytes(&mut self, source: &[u8]) -> JsResult<FunctionBytecodeRef>

Source

pub fn compile_with_filename( &mut self, source: &str, filename: &str, ) -> JsResult<FunctionBytecodeRef>

Source

pub fn compile_with_options( &mut self, source: &str, options: &CompileOptions, ) -> JsResult<FunctionBytecodeRef>

Source

pub fn compile_bytes_with_options( &mut self, source: &[u8], options: &CompileOptions, ) -> JsResult<FunctionBytecodeRef>

Source

pub fn compile_bytes_with_filename( &mut self, source: &[u8], filename: &str, ) -> JsResult<FunctionBytecodeRef>

Compiles source as a script named filename. A syntax error is thrown (RuntimeError::Exception with a SyntaxError). Inside a host function the code is transient whatever the options say.

Source

pub fn execute(&mut self, script: &FunctionBytecodeRef) -> JsResult<Value>

Runs a compiled script with the global object as this.

Source

pub fn compile_module(&mut self, source: &str) -> JsResult<ModuleBytecodeRef>

Source

pub fn compile_module_bytes( &mut self, source: &[u8], ) -> JsResult<ModuleBytecodeRef>

Source

pub fn compile_module_with_filename( &mut self, source: &str, filename: &str, ) -> JsResult<ModuleBytecodeRef>

Source

pub fn compile_module_bytes_with_options( &mut self, source: &[u8], options: &CompileOptions, ) -> JsResult<ModuleBytecodeRef>

Source

pub fn compile_module_bytes_with_filename( &mut self, source: &[u8], filename: &str, ) -> JsResult<ModuleBytecodeRef>

Source

pub fn compile_module_bytes_with_import_meta( &mut self, source: &[u8], filename: &str, import_meta: Vec<(String, Value)>, ) -> JsResult<ModuleBytecodeRef>

Compiles source as the module filename, whose import.meta starts with import_meta (qjs’s url and main). A syntax error is thrown.

Source

pub fn execute_module(&mut self, module: &ModuleBytecodeRef) -> JsResult<Value>

Links and evaluates a compiled module and what it imports; the promise of its evaluation.

Source

pub fn call( &mut self, callable: &CallableRef, this_value: Value, arguments: &[Value], ) -> JsResult<Value>

Source

pub fn construct( &mut self, constructor: &CallableRef, arguments: &[Value], ) -> JsResult<Value>

Source

pub fn construct_with_new_target( &mut self, constructor: &CallableRef, new_target: &CallableRef, arguments: &[Value], ) -> JsResult<Value>

Source

pub fn new_object(&mut self) -> JsResult<ObjectRef>

Source

pub fn new_object_with_prototype( &mut self, prototype: Option<&ObjectRef>, ) -> JsResult<ObjectRef>

Source

pub fn new_array(&mut self) -> JsResult<ObjectRef>

Source

pub fn new_array_from_values( &mut self, values: Vec<Value>, ) -> JsResult<ObjectRef>

Source

pub fn get_own_property( &mut self, object: &ObjectRef, key: &PropertyKey, ) -> JsResult<Option<CompleteOrdinaryPropertyDescriptor>>

Source

pub fn define_own_property( &mut self, object: &ObjectRef, key: &PropertyKey, descriptor: &OrdinaryPropertyDescriptor, ) -> JsResult<bool>

Source

pub fn get_property( &mut self, object: &ObjectRef, key: &PropertyKey, ) -> JsResult<Value>

Source

pub fn get_property_with_receiver( &mut self, object: &ObjectRef, key: &PropertyKey, receiver: Value, ) -> JsResult<Value>

Source

pub fn set_property( &mut self, object: &ObjectRef, key: &PropertyKey, value: Value, ) -> JsResult<bool>

Source

pub fn set_property_with_receiver( &mut self, object: &ObjectRef, key: &PropertyKey, value: Value, receiver: Value, ) -> JsResult<bool>

Source

pub fn delete_property( &mut self, object: &ObjectRef, key: &PropertyKey, ) -> JsResult<bool>

Source

pub fn has_property( &mut self, object: &ObjectRef, key: &PropertyKey, ) -> JsResult<bool>

Source

pub fn has_own_property( &mut self, object: &ObjectRef, key: &PropertyKey, ) -> JsResult<bool>

Source

pub fn own_property_keys( &mut self, object: &ObjectRef, ) -> JsResult<Vec<PropertyKey>>

Source

pub fn get_prototype_of( &mut self, object: &ObjectRef, ) -> JsResult<Option<ObjectRef>>

Source

pub fn set_prototype_of( &mut self, object: &ObjectRef, prototype: Option<&ObjectRef>, ) -> JsResult<bool>

Source

pub fn as_callable( &mut self, object: &ObjectRef, ) -> JsResult<Option<CallableRef>>

The object as a callable reference; None when it is not callable.

Source

pub fn is_constructor(&mut self, object: &ObjectRef) -> JsResult<bool>

Source

pub fn is_array_object(&mut self, object: &ObjectRef) -> JsResult<bool>

IsArray.

Source

pub fn is_error_object(&mut self, object: &ObjectRef) -> JsResult<bool>

Source

pub fn to_js_string(&mut self, value: &Value) -> JsResult<JsString>

ToString(value).

Source

pub fn to_number(&mut self, value: &Value) -> JsResult<f64>

ToNumber(value).

Source

pub fn detach_array_buffer(&mut self, value: &Value) -> JsResult<()>

QuickJS’s JS_DetachArrayBuffer: detaches an ArrayBuffer; anything else is ignored.

Source

pub fn type_of(&mut self, value: &Value) -> JsResult<String>

typeof value.

Source

pub fn print_value(&mut self, value: &Value) -> JsResult<String>

QuickJS’s JS_PrintValue: what print and an uncaught-exception dump show. Runs no JavaScript (no accessor, trap or coercion).

Source

pub fn qjs_print_value_bytes(&mut self, value: &Value) -> JsResult<Vec<u8>>

print_value as the bytes QuickJS writes: a lone surrogate of a raw name, message or stack as its own three bytes (WTF-8) instead of U+FFFD.

Source

pub fn new_symbol( &mut self, description: Option<JsString>, ) -> JsResult<SymbolRef>

Source

pub fn symbol_description( &mut self, symbol: &SymbolRef, ) -> JsResult<Option<JsString>>

Source

pub fn well_known_symbol( &mut self, symbol: WellKnownSymbol, ) -> JsResult<SymbolRef>

Source

pub fn promise_snapshot( &mut self, promise: &ObjectRef, ) -> JsResult<Option<PromiseSnapshot>>

A promise’s state and result; None when promise is not one.

Source

pub fn new_promise(&mut self) -> JsResult<PromiseCapability>

NewPromiseCapability(%Promise%): a pending promise and its resolving functions.

Source

pub fn promise_then( &mut self, promise: &ObjectRef, on_fulfilled: impl HostFunction<Raw>, on_rejected: impl HostFunction<Raw>, ) -> JsResult<ObjectRef>

promise.then(on_fulfilled, on_rejected) with host functions; the promise then returns.

Source

pub fn new_array_buffer(&mut self, bytes: &[u8]) -> JsResult<ObjectRef>

A new ArrayBuffer holding a copy of bytes.

Source

pub fn array_buffer_len( &mut self, buffer: &ObjectRef, ) -> JsResult<Option<usize>>

A buffer’s length in bytes; None for a detached buffer or another object.

Source

pub fn array_buffer_to_vec(&mut self, buffer: &ObjectRef) -> JsResult<Vec<u8>>

A copy of a buffer’s bytes (ArrayBuffer or SharedArrayBuffer); a detached buffer or another object throws a TypeError.

Source

pub fn with_array_buffer_bytes<R>( &mut self, buffer: &ObjectRef, f: impl FnOnce(&[u8]) -> R, ) -> JsResult<R>

Calls f with a buffer’s bytes, borrowed in place for an ArrayBuffer and copied first for a SharedArrayBuffer. f runs inside the engine’s borrow, so it cannot call the engine.

Source

pub fn write_array_buffer( &mut self, buffer: &ObjectRef, offset: usize, data: &[u8], ) -> JsResult<()>

Writes data into a buffer at offset: a TypeError for a detached buffer or another object, a RangeError past its end.

Source

pub fn typed_array_view( &mut self, array: &ObjectRef, ) -> JsResult<Option<TypedArrayView>>

A typed array’s kind, buffer, byte offset and current length; None for anything but a typed array (a DataView included).

Source

pub fn new_typed_array( &mut self, kind: TypedArrayKind, buffer: &ObjectRef, byte_offset: usize, length: Option<usize>, ) -> JsResult<ObjectRef>

new <Kind>Array(buffer, byte_offset, length); without length the view tracks a resizable buffer’s length.

Source

pub fn global_object(&mut self) -> JsResult<ObjectRef>

Source

pub fn object_prototype(&mut self) -> JsResult<ObjectRef>

Source

pub fn array_prototype(&mut self) -> JsResult<ObjectRef>

Source

pub fn function_prototype(&mut self) -> JsResult<ObjectRef>

Source

pub fn iterator_prototype(&mut self) -> JsResult<ObjectRef>

Source

pub fn string_iterator_prototype(&mut self) -> JsResult<ObjectRef>

Source

pub fn number_prototype(&mut self) -> JsResult<ObjectRef>

Source

pub fn boolean_prototype(&mut self) -> JsResult<ObjectRef>

Source

pub fn string_prototype(&mut self) -> JsResult<ObjectRef>

Source

pub fn symbol_prototype(&mut self) -> JsResult<ObjectRef>

Source

pub fn bigint_prototype(&mut self) -> JsResult<ObjectRef>

Source

pub fn function_constructor(&mut self) -> JsResult<CallableRef>

Source

pub fn new_native_error( &mut self, kind: NativeErrorKind, message: &str, ) -> JsResult<Value>

A new native error object (not thrown).

Source

pub fn install_qjs_helpers(&mut self, helpers: &QjsHelpers) -> JsResult<()>

qjs’s print and console.log, scriptArgs, and under std its load and read.

Source

pub fn new_function<Args>( &mut self, options: FunctionOptions, function: impl HostFunction<Args>, ) -> JsResult<CallableRef>

A function whose body is function: a closure over a Scope (|scope: &mut Scope<'_>| …), named and shaped by options.

Source

pub fn define_function<Args>( &mut self, target: &ObjectRef, name: &str, length: u32, function: impl HostFunction<Args>, ) -> JsResult<CallableRef>

Js::new_function defined on target as name, writable and configurable, not enumerable, as QuickJS’s JS_SetPropertyFunctionList defines a method.

Source

pub fn new_host_object<T: 'static>( &mut self, value: T, prototype: Option<&ObjectRef>, ) -> JsResult<ObjectRef>

An object inheriting from prototype (None for null) holding value, which drops when the object is collected.

Source

pub fn host_data<T: 'static>( &mut self, object: &ObjectRef, ) -> JsResult<Option<Rc<T>>>

The value a host object holds; None for an ordinary object or a value of another type.

Trait Implementations§

Source§

impl Js for Scope<'_>

Source§

fn eval(&mut self, source: &str) -> JsResult<Value>

Compiles and runs source as a script; the completion value.
Source§

fn eval_bytes(&mut self, source: &[u8]) -> JsResult<Value>

Source§

fn eval_with_filename( &mut self, source: &str, filename: &str, ) -> JsResult<Value>

Source§

fn eval_with_options( &mut self, source: &str, options: &EvalOptions, ) -> JsResult<Value>

Source§

fn eval_bytes_with_options( &mut self, source: &[u8], options: &EvalOptions, ) -> JsResult<Value>

Source§

fn eval_bytes_with_filename( &mut self, source: &[u8], filename: &str, ) -> JsResult<Value>

Compiles and runs source as a script named filename; the completion value. A syntax error is thrown (RuntimeError::Exception with a SyntaxError), as QuickJS’s JS_Eval does.
Source§

fn compile(&mut self, source: &str) -> JsResult<FunctionBytecodeRef>

Source§

fn compile_bytes(&mut self, source: &[u8]) -> JsResult<FunctionBytecodeRef>

Source§

fn compile_with_filename( &mut self, source: &str, filename: &str, ) -> JsResult<FunctionBytecodeRef>

Source§

fn compile_with_options( &mut self, source: &str, options: &CompileOptions, ) -> JsResult<FunctionBytecodeRef>

Source§

fn compile_bytes_with_options( &mut self, source: &[u8], options: &CompileOptions, ) -> JsResult<FunctionBytecodeRef>

Source§

fn compile_bytes_with_filename( &mut self, source: &[u8], filename: &str, ) -> JsResult<FunctionBytecodeRef>

Compiles source as a script named filename. A syntax error is thrown (RuntimeError::Exception with a SyntaxError). Inside a host function the code is transient whatever the options say.
Source§

fn execute(&mut self, script: &FunctionBytecodeRef) -> JsResult<Value>

Runs a compiled script with the global object as this.
Source§

fn compile_module(&mut self, source: &str) -> JsResult<ModuleBytecodeRef>

Source§

fn compile_module_bytes(&mut self, source: &[u8]) -> JsResult<ModuleBytecodeRef>

Source§

fn compile_module_with_filename( &mut self, source: &str, filename: &str, ) -> JsResult<ModuleBytecodeRef>

Source§

fn compile_module_bytes_with_options( &mut self, source: &[u8], options: &CompileOptions, ) -> JsResult<ModuleBytecodeRef>

Source§

fn compile_module_bytes_with_filename( &mut self, source: &[u8], filename: &str, ) -> JsResult<ModuleBytecodeRef>

Source§

fn compile_module_bytes_with_import_meta( &mut self, source: &[u8], filename: &str, import_meta: Vec<(String, Value)>, ) -> JsResult<ModuleBytecodeRef>

Compiles source as the module filename, whose import.meta starts with import_meta (qjs’s url and main). A syntax error is thrown.
Source§

fn execute_module(&mut self, module: &ModuleBytecodeRef) -> JsResult<Value>

Links and evaluates a compiled module and what it imports; the promise of its evaluation.
Source§

fn call( &mut self, callable: &CallableRef, this_value: Value, arguments: &[Value], ) -> JsResult<Value>

Source§

fn construct( &mut self, constructor: &CallableRef, arguments: &[Value], ) -> JsResult<Value>

Source§

fn construct_with_new_target( &mut self, constructor: &CallableRef, new_target: &CallableRef, arguments: &[Value], ) -> JsResult<Value>

Source§

fn new_object(&mut self) -> JsResult<ObjectRef>

Source§

fn new_object_with_prototype( &mut self, prototype: Option<&ObjectRef>, ) -> JsResult<ObjectRef>

Source§

fn new_array(&mut self) -> JsResult<ObjectRef>

Source§

fn new_array_from_values(&mut self, values: Vec<Value>) -> JsResult<ObjectRef>

Source§

fn get_own_property( &mut self, object: &ObjectRef, key: &PropertyKey, ) -> JsResult<Option<CompleteOrdinaryPropertyDescriptor>>

Source§

fn define_own_property( &mut self, object: &ObjectRef, key: &PropertyKey, descriptor: &OrdinaryPropertyDescriptor, ) -> JsResult<bool>

Source§

fn get_property( &mut self, object: &ObjectRef, key: &PropertyKey, ) -> JsResult<Value>

Source§

fn get_property_with_receiver( &mut self, object: &ObjectRef, key: &PropertyKey, receiver: Value, ) -> JsResult<Value>

Source§

fn set_property( &mut self, object: &ObjectRef, key: &PropertyKey, value: Value, ) -> JsResult<bool>

Source§

fn set_property_with_receiver( &mut self, object: &ObjectRef, key: &PropertyKey, value: Value, receiver: Value, ) -> JsResult<bool>

Source§

fn delete_property( &mut self, object: &ObjectRef, key: &PropertyKey, ) -> JsResult<bool>

Source§

fn has_property( &mut self, object: &ObjectRef, key: &PropertyKey, ) -> JsResult<bool>

Source§

fn has_own_property( &mut self, object: &ObjectRef, key: &PropertyKey, ) -> JsResult<bool>

Source§

fn own_property_keys( &mut self, object: &ObjectRef, ) -> JsResult<Vec<PropertyKey>>

Source§

fn get_prototype_of( &mut self, object: &ObjectRef, ) -> JsResult<Option<ObjectRef>>

Source§

fn set_prototype_of( &mut self, object: &ObjectRef, prototype: Option<&ObjectRef>, ) -> JsResult<bool>

Source§

fn as_callable(&mut self, object: &ObjectRef) -> JsResult<Option<CallableRef>>

The object as a callable reference; None when it is not callable.
Source§

fn is_constructor(&mut self, object: &ObjectRef) -> JsResult<bool>

Source§

fn is_array_object(&mut self, object: &ObjectRef) -> JsResult<bool>

IsArray.
Source§

fn is_error_object(&mut self, object: &ObjectRef) -> JsResult<bool>

Source§

fn to_js_string(&mut self, value: &Value) -> JsResult<JsString>

ToString(value).
Source§

fn to_number(&mut self, value: &Value) -> JsResult<f64>

ToNumber(value).
Source§

fn detach_array_buffer(&mut self, value: &Value) -> JsResult<()>

QuickJS’s JS_DetachArrayBuffer: detaches an ArrayBuffer; anything else is ignored.
Source§

fn type_of(&mut self, value: &Value) -> JsResult<String>

typeof value.
Source§

fn print_value(&mut self, value: &Value) -> JsResult<String>

QuickJS’s JS_PrintValue: what print and an uncaught-exception dump show. Runs no JavaScript (no accessor, trap or coercion).
Source§

fn qjs_print_value_bytes(&mut self, value: &Value) -> JsResult<Vec<u8>>

print_value as the bytes QuickJS writes: a lone surrogate of a raw name, message or stack as its own three bytes (WTF-8) instead of U+FFFD.
Source§

fn new_symbol(&mut self, description: Option<JsString>) -> JsResult<SymbolRef>

Source§

fn symbol_description( &mut self, symbol: &SymbolRef, ) -> JsResult<Option<JsString>>

Source§

fn well_known_symbol(&mut self, symbol: WellKnownSymbol) -> JsResult<SymbolRef>

Source§

fn promise_snapshot( &mut self, promise: &ObjectRef, ) -> JsResult<Option<PromiseSnapshot>>

A promise’s state and result; None when promise is not one.
Source§

fn new_promise(&mut self) -> JsResult<PromiseCapability>

NewPromiseCapability(%Promise%): a pending promise and its resolving functions.
Source§

fn promise_then( &mut self, promise: &ObjectRef, on_fulfilled: impl HostFunction<Raw>, on_rejected: impl HostFunction<Raw>, ) -> JsResult<ObjectRef>

promise.then(on_fulfilled, on_rejected) with host functions; the promise then returns.
Source§

fn new_array_buffer(&mut self, bytes: &[u8]) -> JsResult<ObjectRef>

A new ArrayBuffer holding a copy of bytes.
Source§

fn array_buffer_len(&mut self, buffer: &ObjectRef) -> JsResult<Option<usize>>

A buffer’s length in bytes; None for a detached buffer or another object.
Source§

fn array_buffer_to_vec(&mut self, buffer: &ObjectRef) -> JsResult<Vec<u8>>

A copy of a buffer’s bytes (ArrayBuffer or SharedArrayBuffer); a detached buffer or another object throws a TypeError.
Source§

fn with_array_buffer_bytes<R>( &mut self, buffer: &ObjectRef, f: impl FnOnce(&[u8]) -> R, ) -> JsResult<R>

Calls f with a buffer’s bytes, borrowed in place for an ArrayBuffer and copied first for a SharedArrayBuffer. f runs inside the engine’s borrow, so it cannot call the engine.
Source§

fn write_array_buffer( &mut self, buffer: &ObjectRef, offset: usize, data: &[u8], ) -> JsResult<()>

Writes data into a buffer at offset: a TypeError for a detached buffer or another object, a RangeError past its end.
Source§

fn typed_array_view( &mut self, array: &ObjectRef, ) -> JsResult<Option<TypedArrayView>>

A typed array’s kind, buffer, byte offset and current length; None for anything but a typed array (a DataView included).
Source§

fn new_typed_array( &mut self, kind: TypedArrayKind, buffer: &ObjectRef, byte_offset: usize, length: Option<usize>, ) -> JsResult<ObjectRef>

new <Kind>Array(buffer, byte_offset, length); without length the view tracks a resizable buffer’s length.
Source§

fn global_object(&mut self) -> JsResult<ObjectRef>

Source§

fn object_prototype(&mut self) -> JsResult<ObjectRef>

Source§

fn array_prototype(&mut self) -> JsResult<ObjectRef>

Source§

fn function_prototype(&mut self) -> JsResult<ObjectRef>

Source§

fn iterator_prototype(&mut self) -> JsResult<ObjectRef>

Source§

fn string_iterator_prototype(&mut self) -> JsResult<ObjectRef>

Source§

fn number_prototype(&mut self) -> JsResult<ObjectRef>

Source§

fn boolean_prototype(&mut self) -> JsResult<ObjectRef>

Source§

fn string_prototype(&mut self) -> JsResult<ObjectRef>

Source§

fn symbol_prototype(&mut self) -> JsResult<ObjectRef>

Source§

fn bigint_prototype(&mut self) -> JsResult<ObjectRef>

Source§

fn function_constructor(&mut self) -> JsResult<CallableRef>

Source§

fn new_native_error( &mut self, kind: NativeErrorKind, message: &str, ) -> JsResult<Value>

A new native error object (not thrown).
Source§

fn install_qjs_helpers(&mut self, helpers: &QjsHelpers) -> JsResult<()>

qjs’s print and console.log, scriptArgs, and under std its load and read.
Source§

fn new_function<Args>( &mut self, options: FunctionOptions, function: impl HostFunction<Args>, ) -> JsResult<CallableRef>

A function whose body is function: a closure over a Scope (|scope: &mut Scope<'_>| …), named and shaped by options.
Source§

fn define_function<Args>( &mut self, target: &ObjectRef, name: &str, length: u32, function: impl HostFunction<Args>, ) -> JsResult<CallableRef>

Js::new_function defined on target as name, writable and configurable, not enumerable, as QuickJS’s JS_SetPropertyFunctionList defines a method.
Source§

fn new_host_object<T: 'static>( &mut self, value: T, prototype: Option<&ObjectRef>, ) -> JsResult<ObjectRef>

An object inheriting from prototype (None for null) holding value, which drops when the object is collected.
Source§

fn host_data<T: 'static>( &mut self, object: &ObjectRef, ) -> JsResult<Option<Rc<T>>>

The value a host object holds; None for an ordinary object or a value of another type.
Source§

fn throw_error(&mut self, kind: NativeErrorKind, message: &str) -> RuntimeError

An error object of kind with message and a stack from the running frames, as the error to return: return Err(js.throw_error(NativeErrorKind::Type, "x is required")).

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Scope<'a>

§

impl<'a> !Send for Scope<'a>

§

impl<'a> !Sync for Scope<'a>

§

impl<'a> !UnwindSafe for Scope<'a>

§

impl<'a> Freeze for Scope<'a>

§

impl<'a> Unpin for Scope<'a>

§

impl<'a> UnsafeUnpin for Scope<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.