Struct boa::builtins::function::Captures[][src]

pub struct Captures(_);
Expand description

Wrapper for Box<dyn NativeObject + Clone> that allows passing additional captures through a Copy closure.

Any type implementing Trace + Any + Debug + Clone can be used as a capture context, so you can pass e.g. a String, a tuple or even a full struct.

You can downcast to any type and handle the fail case as you like with downcast_ref and downcast_mut, or you can use try_downcast_ref and try_downcast_mut to automatically throw a TypeError if the downcast fails.

Implementations

Downcasts Captures to the specified type, returning a reference to the downcasted type if successful or None otherwise.

Mutably downcasts Captures to the specified type, returning a mutable reference to the downcasted type if successful or None otherwise.

Downcasts Captures to the specified type, returning a reference to the downcasted type if successful or a TypeError otherwise.

Downcasts Captures to the specified type, returning a reference to the downcasted type if successful or a TypeError otherwise.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Marks all contained Gcs.

Increments the root-count of all contained Gcs.

Decrements the root-count of all contained Gcs.

Runs Finalize::finalize() on this object and all contained subobjects Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Convert the Rust type which implements NativeObject to a &dyn Any.

Convert the Rust type which implements NativeObject to a &mut dyn Any.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.