pub enum Callable {
Bytecode {
code: Gc<CompiledCode>,
env: Gc<ClosureEnv>,
},
Bound {
target: Value,
this: Value,
args: Vec<Value>,
},
Native {
func: NativeFn,
},
}Expand description
The body of a callable object.
Variants§
Bytecode
A function compiled from JavaScript source.
Fields
§
code: Gc<CompiledCode>The bytecode and slot mapping.
§
env: Gc<ClosureEnv>The captured environment.
Bound
A function produced by Function.prototype.bind.
This is a variant rather than a native function carrying the state in
properties because the state is not observable: bind has to remember its
target, this and leading arguments, and a native trampoline cannot capture
them.
Fields
Native
A built-in implemented in Rust.
The name and length a script observes are ordinary properties on the
function object, not fields here: they are writable (f.name = "x" works)
and would otherwise be two sources of truth.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Callable
impl !Send for Callable
impl !Sync for Callable
impl !UnwindSafe for Callable
impl Forget for Callable
impl Freeze for Callable
impl Move for Callable
impl Unpin for Callable
impl UnsafeUnpin for Callable
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