Skip to main content

Context

Struct Context 

Source
pub struct Context { /* private fields */ }
Expand description

The runtime’s one realm.

Implementations§

Source§

impl Context

The handle of the runtime’s one realm. Its operations are listed with the Js trait, which a host function’s Scope shares; each is an inherent method and one engine entry.

Source

pub fn new(runtime: &Runtime) -> Self

The runtime’s realm (a second call returns the same one).

Source

pub fn try_clone(&self) -> Result<Self, RuntimeError>

Source

pub fn runtime(&self) -> &Runtime

Source

pub fn define_module( &self, name: &str, exports: Vec<(String, Value)>, ) -> Result<(), RuntimeError>

Makes exports the module name: an import of the name sees each value under its name (default is the default export), as the module a ModuleLoader returns as ModuleSource::Synthetic. A second definition of the name replaces the first for later imports.

Source§

impl Context

Source§

impl Context

Source

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

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

Source

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

Source

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

Source

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

Source

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

Source

pub fn eval_bytes_with_filename( &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(&self, source: &str) -> JsResult<FunctionBytecodeRef>

Source

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

Source

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

Source

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

Source

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

Source

pub fn compile_bytes_with_filename( &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(&self, script: &FunctionBytecodeRef) -> JsResult<Value>

Runs a compiled script with the global object as this.

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub fn compile_module_bytes_with_import_meta( &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(&self, module: &ModuleBytecodeRef) -> JsResult<Value>

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

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

Source

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

Source

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

IsArray.

Source

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

Source

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

ToString(value).

Source

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

ToNumber(value).

Source

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

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

Source

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

typeof value.

Source

pub fn print_value(&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(&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(&self, description: Option<JsString>) -> JsResult<SymbolRef>

Source

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

Source

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

Source

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

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

Source

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

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

Source

pub fn promise_then( &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(&self, bytes: &[u8]) -> JsResult<ObjectRef>

A new ArrayBuffer holding a copy of bytes.

Source

pub fn array_buffer_len(&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(&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>( &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( &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( &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( &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(&self) -> JsResult<ObjectRef>

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

A new native error object (not thrown).

Source

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

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

Source

pub fn new_function<Args>( &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>( &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>( &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>( &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 Clone for Context

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Js for Context

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§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.