Skip to main content

JsHost

Struct JsHost 

Source
pub struct JsHost {
Show 21 fields pub funcs: Vec<FuncDef>, pub scripts: Vec<Arc<str>>, pub source_map: Vec<ScriptRange>, pub tries: Vec<TryDef>, pub error: Option<String>, pub exc: Option<Value>, pub throw_site: Option<ThrowSite>, pub fatal_from_promise: bool, pub module_frame_done: bool, pub async_frame: AsyncFrame, pub signal: Option<Signal>, pub delegate_resume: Option<DelegateResume>, pub pending_rejections: Vec<u32>, pub process_listeners: IndexMap<String, Vec<ProcListener>>, pub buffer_pool: Option<(Value, usize, usize)>, pub nextticks: VecDeque<Task>, pub microtasks: VecDeque<Task>, pub macrotasks: Vec<Timer>, pub exit_code: Option<i32>, pub fatal_handler_failed: bool, pub exiting: bool, /* private fields */
}
Expand description

The JavaScript runtime.

Fields§

§funcs: Vec<FuncDef>

Function templates, indexed by def id.

§scripts: Vec<Arc<str>>

Every script text a loaded program was parsed from; a FuncDef’s script indexes it and its span slices it.

§source_map: Vec<ScriptRange>

The scripts that own a range of the source address space, by ascending base — what a source position resolves against. See JsHost::register_source.

§tries: Vec<TryDef>

try/catch/finally block templates, indexed by try id.

§error: Option<String>§exc: Option<Value>

The in-flight thrown value, if any (JS throw).

§throw_site: Option<ThrowSite>

Where the in-flight exception was raised — see ThrowSite.

§fatal_from_promise: bool

Whether the exception that is about to end the process is an unhandled promise rejection, whose source arrow node takes from where the error was CREATED rather than from where it was thrown.

§module_frame_done: bool

Whether the module frame (frame 0) no longer runs the program’s top level: once that has returned, or when the entry is an ES module (whose body runs in a function of its own). A stack then leaves the frame out.

§async_frame: AsyncFrame

The current async context frame (see Task).

§signal: Option<Signal>§delegate_resume: Option<DelegateResume>

A forced .return(v) / .throw(e) that arrived at a yield*, waiting for the delegate step that applies it to the delegate (see DelegateResume).

§pending_rejections: Vec<u32>

Promises that settled REJECTED this tick. Drained at each microtask checkpoint: any still without a handler is an unhandled rejection.

§process_listeners: IndexMap<String, Vec<ProcListener>>

process.on(event, fn) listeners, by event name.

§buffer_pool: Option<(Value, usize, usize)>

lib/buffer.js’s shared allocation pool, (allocPool, poolSize, poolOffset) — created on first use by buffer::pooled.

§nextticks: VecDeque<Task>

process.nextTick callbacks (drained before promise microtasks).

§microtasks: VecDeque<Task>

Promise-reaction / queueMicrotask microtasks.

§macrotasks: Vec<Timer>

setTimeout/setInterval/setImmediate macrotasks.

§exit_code: Option<i32>

process.exitCode: the code the process exits with when the event loop drains, or None while unset. Separate from an explicit process.exit(n), which exits immediately with n.

§fatal_handler_failed: bool

An uncaughtException listener itself threw. Node treats that as fatal with status 7 and fires no exit event.

§exiting: bool

Whether the exit event has already been emitted, so the process.exit path and the end-of-loop path cannot both fire it (Node’s _exiting).

Implementations§

Source§

impl JsHost

Source

pub fn new() -> JsHost

Source

pub fn is_global_object(&self, v: &Value) -> bool

Whether v IS the one globalThis object (not merely an object).

Source

pub fn global_object(&mut self) -> Value

The globalThis object — one per host, so its identity and its properties both survive across reads.

Source

pub fn proto_of(&self, v: &Value) -> Option<Value>

The [[Prototype]] of a heap value, if explicitly linked.

Source

pub fn set_proto(&mut self, v: &Value, proto: Value)

Set v’s [[Prototype]] to proto. Null links the object as an explicit null-prototype object (recorded so instanceof Object reads false); undefined just clears any link without the null marker.

Source

pub fn has_null_proto(&self, v: &Value) -> bool

Whether v’s [[Prototype]] was explicitly set to null.

Source

pub fn inspects_null_proto(&self, v: &Value) -> bool

Whether util.inspect renders v with the [Object: null prototype] tag. That is a question about the object’s ACTUAL [[Prototype]], which for Object.prototype is null even though nothing ever set it so: it is the chain root and was never passed through set_proto, so the explicitly-nulled registry does not hold it and console.log(Object .prototype) printed a bare {} where node prints the tag.

Kept apart from Self::has_null_proto, which nine other call sites ask about whether Object.prototype’s own methods and __proto__ accessor are INHERITED. Object.prototype inherits nothing and still owns all of them.

Source

pub fn object_proto(&self) -> Value

Source

pub fn tag_proto_class(&mut self, proto: &Value, class_val: Value)

Record that the prototype object proto belongs to the class constructor class_val (so instances can recover their constructor).

Source

pub fn class_owning_proto(&self, v: &Value) -> Option<Value>

The class whose prototype object IS v, if v is one.

Source

pub fn class_of(&self, obj: &Value) -> Option<Value>

The class constructor value nearest in obj’s prototype chain, if any.

Source

pub fn ctor_name(&self, obj: &Value) -> String

The constructor display name of obj for util.inspect (empty ⇒ plain object, no prefix).

Source

pub fn generator_kind(&self, v: &Value) -> Option<&'static str>

Whether a callable owns a prototype property. MakeConstructor (10.2.5) runs for an ordinary function definition and for every generator; an arrow, a MethodDefinition, an async function and a bound function are not constructors and own none. Some("Generator") / Some("AsyncGenerator") for a function* / async function*, naming the intrinsic its objects inherit from.

Source

pub fn owns_prototype(&self, v: &Value) -> bool

Source

pub fn fn_prop(&self, v: &Value, name: &str) -> Option<Value>

A function’s own-property table (created on demand).

Source

pub fn class_static(&self, class_val: &Value, name: &str) -> Option<Value>

A class static member, inherited down the constructor chain: a subclass sees its superclass’s static methods/fields (Sub.create → Base.create).

Source

pub fn class_builtin_ancestor(&self, class_val: &Value) -> Option<Value>

The first extends ancestor that is NOT a user class — the builtin constructor a class chain bottoms out in (class D extends Array {} → the Array builtin), or None for a chain of user classes only.

class_static walks ClassVal.parent and gives up the moment the parent stops being a Class, so a static declared by the BUILTIN half of the chain was unreachable: D.from read undefined where node inherits Array.from. Returning the ancestor lets the caller finish the lookup with an ordinary property read, which is what reaches a builtin’s statics.

Source

pub fn set_fn_prop(&mut self, v: &Value, name: &str, val: Value)

Source

pub fn builtin_static(&self, ns: &str, name: &str) -> Option<Value>

A user-assigned static on a builtin namespace (Error.prepareStackTrace).

Source

pub fn set_builtin_static(&mut self, ns: &str, name: &str, val: Value)

Assign a static on a builtin namespace (persists across fresh Builtin handles for the same namespace).

Source

pub fn remove_builtin_static(&mut self, ns: &str, name: &str) -> bool

delete <ns>.<name> for a script-assigned static. Reports whether the key was there — without this, delete Array.prototype.patch answered true and left the entry in place, so the patch outlived its own removal.

Source

pub fn builtin_static_keys(&self, ns: &str) -> Vec<String>

Every namespace a script has assigned a static onto, with that namespace’s assigned keys — the source of the user-added half of Object.getOwnPropertyNames(Array.prototype).

Source

pub fn remove_fn_prop(&mut self, v: &Value, name: &str) -> bool

Drop an own property from the side table (delete arr.foo, delete fn.tag). Reports whether the key was there.

Source

pub fn mark_fn_intrinsic_deleted(&mut self, v: &Value, key: &str)

delete fn.length / delete fn.name: remember that the synthesized own property is gone so every reader falls through to Function.prototype.

Source

pub fn fn_intrinsic_deleted(&self, v: &Value, key: &str) -> bool

Whether the synthesized length/name of v has been deleted and not since redefined (a redefinition stores a real side-table entry).

Source

pub fn fn_intrinsic_readonly(&self, v: &Value, key: &str) -> bool

Whether a write to key hits a read-only length/name: still synthesized (no stored redefinition) and, for name, already non-empty. An EMPTY name is left writable because the compiler’s NamedEvaluation (SetFunctionName on an anonymous function) assigns it through the same store as a script assignment.

Source

pub fn fn_prop_keys(&self, v: &Value) -> Vec<String>

Source

pub fn set_accessor( &mut self, owner: &Value, key: &str, get: Option<Value>, set: Option<Value>, )

Install an accessor (get, set) for key on the object owner.

Source

pub fn remove_accessor(&mut self, owner: &Value, key: &str)

The accessor (get, set) for key directly on owner (no chain walk). Drop an own accessor property entirely, marker and all.

delete obj.accessorProp used to clear only the property map, and an accessor does not live there — so the delete reported success while the getter kept answering and in kept reporting the key.

Source

pub fn accessor_to_data(&mut self, owner: &Value, key: &str, value: Value)

Turn an own accessor property into a data property carrying value, keeping its place in the own-key order.

set_accessor records that order with an @@ord: marker in the property map rather than a real key, so deleting the accessor and inserting the value would append the key at the end instead. Node reports { a: 1, get b() {}, c: 3 } redefined through Object.defineProperty(o, 'b', { value }) as a, b, c.

Source

pub fn move_index_state(&mut self, src: u32, dst: u32)

Move the per-heap-index bookkeeping of src onto dst.

Used when one object becomes another in place (a class extending a builtin exotic). The prototype link is deliberately NOT moved: dst already points at the leaf class’s prototype, which is the one its methods must resolve through.

Source

pub fn own_accessor( &self, owner: &Value, key: &str, ) -> Option<(Option<Value>, Option<Value>)>

Source

pub fn own_accessor_keys(&self, owner: &Value) -> Vec<String>

The own accessor-property keys of owner, in installation order.

Source

pub fn set_prop_attrs(&mut self, owner: &Value, key: &str, attrs: PropAttrs)

Record non-default attributes for owner[key]. Storing the default shape clears the entry so the table only ever holds deviations.

Source

pub fn copy_prop_attrs(&mut self, from: &Value, to: &Value)

Copy every recorded property attribute from from to to. A pass that rebuilds an object (JSON.stringify’s toJSON walk) must carry them across or the copy silently re-exposes non-enumerable slots.

Source

pub fn prop_attrs(&self, owner: &Value, key: &str) -> PropAttrs

The attributes of own property owner[key] (all-true when unrecorded).

Source

pub fn is_enumerable(&self, owner: &Value, key: &str) -> bool

Whether own property owner[key] shows up in for-in/Object.keys. Internal slots (@@…) and private class fields (#…) never do.

Source

pub fn hide_prop(&mut self, owner: &Value, key: &str)

Mark owner[key] non-enumerable, leaving it writable/configurable — the shape of every V8 “hidden but real” own property.

Source

pub fn can_write_prop(&self, owner: &Value, key: &str) -> bool

Whether a plain owner[key] = v assignment is allowed to land. A non-writable data property silently ignores the write in sloppy mode, which is the mode every script here runs in; so does adding a new key to a non-extensible object.

Source

pub fn past_fixed_length(&self, owner: &Value, key: &str) -> bool

Whether key is an array index at or past the length of an array whose length is not writable — an element 10.4.2.1 step 3.b refuses to add, since adding it would have to grow length.

Source

pub fn prevent_extensions(&mut self, v: &Value)

Mark v closed to new properties (Object.preventExtensions).

Source

pub fn is_extensible(&self, v: &Value) -> bool

Source

pub fn has_integrity_limits(&self, v: &Value) -> bool

Whether v is closed to new properties or carries any own property that is not a plain writable, enumerable, configurable data property — the objects on which a write or delete can be refused.

Source

pub fn seal_object(&mut self, v: &Value, freeze: bool)

Apply Object.seal (freeze == false) or Object.freeze (true): close the object and strip configurable — and, when freezing, writable — from every own property, data and accessor alike.

Source

pub fn is_sealed(&self, v: &Value, freeze: bool) -> bool

Object.isSealed (freeze == false) / Object.isFrozen (true).

Source

pub fn new_symbol(&mut self, desc: Option<String>) -> Value

A fresh unique Symbol(desc) value.

Source

pub fn symbol_of_key(&self, k: &str) -> Option<Value>

The symbol VALUE an internal symbol property key (@@sym:<id> or a well-known @@iterator) came from.

Source

pub fn own_symbol_keys(&self, v: &Value) -> Vec<Value>

The own symbol-keyed property keys of v as SYMBOL values — Object.getOwnPropertySymbols / the symbol half of Reflect.ownKeys.

Source

pub fn own_symbol_entries(&self, v: &Value) -> Vec<(String, Value)>

The own SYMBOL-keyed enumerable (internal key, value) pairs of v — what CopyDataProperties (object spread, Object.assign) copies alongside the string keys, and what Object.keys / for-in / JSON.stringify deliberately skip.

Source

pub fn symbol_for(&mut self, key: &str) -> Value

The shared Symbol.for(key) value (interned by description).

Source

pub fn internal_symbol(&mut self, desc: &str) -> Value

A process-wide symbol node keeps privately (events.errorMonitor): one identity for every read, described by desc, but NOT in the Symbol.for registry, so Symbol.keyFor answers undefined for it. It shares the registry map under a @@Symbol. key, which symbol_registry_key already excludes.

Source

pub fn symbol_registry_key(&mut self, sym: &Value) -> Value

Symbol.keyFor(sym): the registry key Symbol.for interned sym under, or undefined for a symbol that is not in the registry at all.

Matched by symbol IDENTITY, not by description — Symbol.for('k') and Symbol('k') share a description and only the first is registered. The @@Symbol.* well-known entries are registry-internal and never a keyFor answer, matching node: Symbol.keyFor(Symbol.iterator) is undefined there.

Source

pub fn well_known_iterator(&mut self) -> Value

The well-known Symbol.iterator (a fixed shared symbol whose internal property key is @@iterator).

Source

pub fn well_known_async_iterator(&mut self) -> Value

The well-known Symbol.asyncIterator (internal key @@asyncIterator).

Source

pub fn well_known_symbol(&mut self, name: &str) -> Value

A well-known symbol by its ECMAScript name (toPrimitive, toStringTag, …). Its internal property key is @@<name> — see WELL_KNOWN_SYMBOLS and property_key.

Its DESCRIPTION is Symbol.<name>, so String(Symbol.iterator) prints Symbol(Symbol.iterator) as V8 does, while the registry key keeps the @@ prefix — Symbol.for('Symbol.iterator') therefore stays a different symbol, and identification is by id, so a user-made Symbol('Symbol.iterator') is not mistaken for the well-known one.

Source

pub fn property_key(&self, v: &Value) -> String

The internal property-key string for a value used as a key. A Symbol maps to a stable per-symbol string so symbol-keyed props round-trip; Symbol.iterator maps to the sentinel @@iterator.

Source

pub fn null(&self) -> Value

Source

pub fn is_null(&self, v: &Value) -> bool

Source

pub fn program_offsets(&self) -> (usize, usize)

Source

pub fn load_program(&mut self, funcs: Vec<FuncDef>, tries: Vec<TryDef>)

Source

pub fn func_source(&self, def_id: usize) -> Option<&str>

The source text of function def_id, when its program kept one.

Source

pub fn try_def(&self, id: usize) -> Option<TryDef>

Source

pub fn try_shape(&self, id: usize) -> Option<(bool, Option<String>, bool)>

What try statement id HAS — (has handler, catch parameter name, has finalizer) — without copying its chunks. Running a try used to clone the whole TryDef, so a try inside a loop deep-copied its block, its handler and its finalizer on every iteration just to learn its shape.

Source

pub fn try_chunk(&self, id: usize, part: u64) -> Option<Chunk>

One try part’s bytecode: 0 = block, 1 = handler body, 2 = finalizer. Reached only when no pooled VM already holds that chunk.

Source

pub fn alloc(&mut self, obj: JsObj) -> Value

Source

pub fn get(&self, v: &Value) -> Option<&JsObj>

Source

pub fn get_mut(&mut self, v: &Value) -> Option<&mut JsObj>

Source

pub fn kind_of(&self, v: &Value) -> Option<ObjKind>

Which variant v points at, without copying its contents. Use this in place of get(v).cloned() whenever only the tag is needed — see ObjKind.

Source

pub fn new_str(&mut self, s: impl Into<String>) -> Value

Source

pub fn new_array(&mut self, items: Vec<Value>) -> Value

Source

pub fn note_private_method(&mut self, name: &str)

Record that name was declared as a private method or accessor.

Source

pub fn is_private_method(&self, name: &str) -> bool

Whether name was declared as a private method/accessor by some class, as opposed to a private field.

Source

pub fn fn_is_sloppy(&self, v: &Value) -> bool

The name of the class whose body the running function belongs to. Only a method of that class can even mention its private names, so this is the class a failed brand check must name. The super binding of the frame now running: the owning class name, whether the method is static, and the home object of an object-literal method. An ARROW captures all three at creation, the way it captures this — super inside an arrow means the enclosing METHOD’s super. Whether the activation now running is strict code. Whether v is a function whose own body is SLOPPY — not an arrow, and with no 'use strict' of its own or inherited from its script. This is the receiver test the arguments/caller poison pill keys on: node decides by the FUNCTION, never by the code doing the reading.

Source

pub fn current_strict(&self) -> bool

Source

pub fn with_forced_strict<T>(f: impl FnOnce() -> T) -> T

Run f with every write refusal treated as in strict code, whatever the running function’s own mode: a builtin that performs Set(O, P, V, true) (Object.assign) throws on a refused write even when called from sloppy code.

Source

pub fn set_current_strict(&mut self)

Mark the frame about to run as STRICT — used for a program whose own top level says 'use strict', which has no FuncDef to carry the flag.

Source

pub fn current_home(&self) -> (Option<String>, bool, Option<Value>)

Source

pub fn current_home_class_name(&self) -> Option<String>

Source

pub fn has_private(&self, recv: &Value, key: &str) -> bool

Whether recv itself carries the private name key. Private elements are never inherited — Object.create(instance) has none of its prototype’s — so a private METHOD is installed on every instance when it is constructed (see install_private_methods) rather than found one link up on the class prototype.

Source

pub fn current_home_proto(&self) -> Option<Value>

C.prototype of the class whose method is running.

Source

pub fn is_hole(&self, arr: &Value, i: usize) -> bool

Whether element i of array arr is an elided element (a “hole”), as opposed to a stored undefined. false for anything that is not an array, and for every index of a dense one.

Source

pub fn has_holes(&self, arr: &Value) -> bool

Whether arr has any elided element at all — one hash probe, and the guard every hole-aware code path takes before doing anything slower.

Source

pub fn hole_indices(&self, arr: &Value) -> Vec<usize>

arr’s hole positions in ASCENDING order, or an empty vec if dense. Sorted because every consumer (own-key enumeration, util.inspect run-grouping) needs index order, and the backing set has none.

Source

pub fn mark_hole(&mut self, arr: &Value, i: usize)

Record element i of arr as elided.

Source

pub fn mark_hole_range(&mut self, arr: &Value, range: Range<usize>)

Record range of arr as elided (a new Array(n), a length grow, or the gap a write past the end opens).

Source

pub fn clear_hole(&mut self, arr: &Value, i: usize)

Element i now holds a real value: it is no longer a hole. Every write to an array index calls this, which is what keeps a stale hole record from outliving the elision it described.

Source

pub fn clear_holes(&mut self, arr: &Value)

arr is dense from here on (fill over the whole array, a fresh dense assignment into an existing handle).

Source

pub fn copy_holes( &mut self, src: &Value, dst: &Value, f: impl Fn(usize) -> Option<usize>, )

Copy src’s elision set onto dst, optionally shifting each position by f. Used by every method that derives a new array whose holes track the source’s (slice, concat, map).

Source

pub fn remap_holes(&mut self, arr: &Value, f: impl Fn(usize) -> Option<usize>)

Rewrite arr’s own elision set in place: f(i) gives the position each existing hole moves to, or None if the mutation removed it. This is the one primitive behind every structural array mutation — shift is i.checked_sub(1), unshift(k) is i + k, reverse is len-1-i, and splice is the general case.

Source

pub fn install_holes(&mut self, arr: &Value, holes: FxHashSet<usize>)

Replace arr’s elision set outright, dropping the record entirely when the new set is empty so has_holes stays a single negative probe for the dense case.

Source

pub fn truncate_holes(&mut self, arr: &Value, len: usize)

Forget any hole at or past len — what a pop, a length shrink or a truncating splice leaves behind.

Source

pub fn new_object(&mut self, props: IndexMap<String, Value>) -> Value

Source

pub fn as_str(&self, v: &Value) -> Option<String>

Source

pub fn frame_depth(&self) -> usize

Number of active call frames (the debugger’s step-depth reference).

Source

pub fn set_cur_line(&mut self, line: u32)

Record the source line the innermost frame is executing (DAP line hook).

Source

pub fn stack_trace_limit(&self) -> usize

V8’s Error.stackTraceLimit — how many frames a captured stack keeps.

The default is 10, it is settable, and setting it to 0 is the documented way to make error construction cheap. It did not exist, so the read was undefined and every stack carried every frame regardless.

Source

pub fn stack_frames(&self) -> String

The .stack tail for an error created right now: one at … line per live frame, innermost first, in V8’s CallSite format — at f (file:line:col), at new C (…), at Object.m (…), and the bare at file:line:col of an anonymous function or a script’s top level.

Each frame’s location is the op it was executing when it last called out (see Frame::pos), so the innermost frame of a new Error() names the new and every outer frame names its call. These are the user’s frames only: node’s own loader frames (Module._compile, …) and the frames of native functions (Array.map (<anonymous>)) do not exist in this runtime.

Source

pub fn stack_frames_from(&self, top: usize) -> String

JsHost::stack_frames over the frames below top — the error constructors skip the frames of the subclass constructors that are building the error, as V8’s SKIP_UNTIL_SEEN mode does.

Source

pub fn register_source(&mut self, script: u32, origin: ScriptOrigin) -> u32

Give script the next range of the source address space and return its base: a crate::ast::Pos p in that script becomes base + p - 1, so one u32 names a place in any loaded script. Ranges are never reused.

Source

pub fn name_position(&self, pos: u32, name: &str) -> u32

The position of the first reference to identifier name at or after pos, else pos itself.

An identifier carries no position of its own, so an op that reads or writes a name is placed at its statement; V8 places a ReferenceError at the identifier. The first whole-word occurrence from the statement on that is not a property name (o.name) is the reference evaluated first.

Source

pub fn source_location(&self, pos: u32) -> Option<SourceLocation<'_>>

Resolve a source-address-space position (0: none) to its script’s name, line, column and line text.

Source

pub fn stack_depth(&self) -> usize

How many frames are live, counting those of the contexts that resumed the running generator or async body.

Source

pub fn frame_pos_below(&self, top: usize) -> u32

Where the innermost frame below top is: where an error whose stack starts there was created.

Source

pub fn error_capture_top(&self) -> usize

The frames an error constructed now captures end below this index.

An error built through super() from a subclass constructor does not show the constructors that are building it: V8 captures in SKIP_UNTIL_SEEN mode, skipping every frame up to and including the one running new.target, so new MyErr() reports the frame that said new. Those are the innermost frames that are derived constructors still waiting on super(), all for the same new.target.

Source

pub fn note_raise(&mut self, msg: &str, pos: u32, native: bool)

Record that the op at source position pos raised msg — unless this is the same raise propagating outward (see ThrowSite). A raise the runtime makes (native: not a JS throw) also keeps the live frames, for the error object a catch or the fatal report builds later.

Source

pub fn raise_frames(&self, msg: &str) -> String

The stack frames an error built from runtime error string msg carries: those live when it was raised, if that raise was recorded, else the current ones.

Source

pub fn dbg_stack(&self) -> Vec<(String, u32)>

The call stack as (frame name, line) pairs, innermost first — for the DAP stackTrace. owner carries the function name where known.

Source

pub fn dbg_locals(&self) -> Vec<(String, String)>

The innermost frame’s locals as (name, inspect) pairs — for DAP variables.

Source

pub fn is_tdz_global(&self, name: &str) -> bool

Scope-chain read: local + enclosing chain, then globals. Whether name is a module-top-level binding that has not reached its declaration yet. Separate from JsHost::is_tdz, which answers for a block-scoped one by inspecting the value it holds.

Source

pub fn read_name(&self, name: &str) -> Option<Value>

Source

pub fn read_global(&self, name: &str) -> Option<Value>

Source

pub fn has_name(&self, name: &str) -> bool

Whether name is bound anywhere on the scope chain or in the globals — read_name(..).is_some() without cloning the value it finds. The strict-mode assignment path asks this and nothing else.

Source

pub fn set_name(&mut self, name: &str, val: Value) -> bool

Assign to an existing binding up the scope chain, else create a global (JS assignment to an undeclared name targets the global object). Assign to an existing binding, or create a global. Returns false when the nearest binding is an immutable (const) one, which the caller turns into TypeError: Assignment to constant variable. — assigning to a const used to succeed SILENTLY, so code that node rejects ran on with a mutated constant.

Source

pub fn declare_const_name(&mut self, name: &str, val: Value)

Declare a const binding: the same placement as Self::declare_name, plus recording the name as immutable in whichever scope received it.

Source

pub fn tdz_marker(&mut self) -> Value

The value a lexical binding holds between entering its scope and reaching its declaration — its TEMPORAL DEAD ZONE. One heap object for the whole process, so the check is a heap-index comparison and the marker cannot be produced by any JavaScript expression. It never escapes: every path that could read it throws first.

Source

pub fn is_tdz(&self, v: &Value) -> bool

Whether v is the uninitialized-binding marker.

Source

pub fn hoist_tdz(&mut self, name: &str)

Declare name in the CURRENT scope as uninitialized, unless that scope already binds it. Emitted at the top of every scope for each let, const and class declared directly in it, so a read before the declaration throws instead of finding an OUTER binding of the same name — let x = 1; { x; let x = 2 } used to read the outer 1.

Source

pub fn declare_name(&mut self, name: &str, val: Value)

Declare a new binding in the current scope (let/const). At the top of the module frame there is no local env, so those names become globals; once a block scope is open the binding belongs to that block.

Source

pub fn hoist_var_name(&mut self, name: &str)

Declare a var (or a hoisted function declaration): FUNCTION-scoped, so it skips every open block scope and lands in the activation’s base env. Create a hoisted var binding, initialised to undefined, only when the name is not already bound in this activation.

var bindings come into existence when the scope is entered, not where the declaration is written — f(){ x; var x = 1 } reads undefined rather than throwing. “If absent” is what keeps a parameter intact: in function f(a) { var a; } the var names a binding that already exists and must not be reset, which is also why a bare var x; emits nothing at its own position.

Source

pub fn declare_var_name(&mut self, name: &str, val: Value)

Source

pub fn push_with_scope(&mut self, obj: Value)

Enter a with scope whose binding object is obj.

Source

pub fn in_with_scope(&self) -> bool

Whether the running code sits inside a with body.

Source

pub fn with_objects_before_binding(&self, name: &str) -> Vec<Value>

The with binding objects name would be looked up on, innermost first, stopping at the first ordinary scope that binds it: an inner binding shadows every object beyond it.

Source

pub fn map_arguments(&mut self, names: &[String])

Alias the parameters named by names (in order) to the arguments object bound in the nearest scope that has one — 10.4.4.7 CreateMappedArgumentsObject. Only indices the caller supplied are mapped, and a name that repeats is mapped at its LAST occurrence only.

Source

pub fn write_mapped_argument(&mut self, args: &Value, i: usize, val: &Value)

arguments[i] = v on a mapped object: write the aliased parameter too.

Source

pub fn sync_arguments_to_params(&mut self, args: &Value)

After an Array.prototype mutator rewrote a mapped arguments object’s elements in place, push every still-aliased element into its parameter.

Source

pub fn unmap_argument(&mut self, args: &Value, i: usize)

delete arguments[i]: the index stops aliasing its parameter.

Source

pub fn push_scope(&mut self)

Enter a fresh block scope.

Source

pub fn push_var_scope(&mut self) -> Env

Open a scope that is also the activation’s VARIABLE environment, and return the previous one so the caller can restore it.

A block scope is not enough for a strict direct eval: var and a hoisted function declaration bind to base_env, so they walked straight past a plain push_scope and still landed in the caller’s function scope. Only let/const were contained.

Source

pub fn pop_var_scope(&mut self, prev: Env)

Restore the variable environment a push_var_scope replaced.

Source

pub fn pop_scope(&mut self)

Leave the innermost block scope (never pops past the activation’s base).

Source

pub fn copy_scope(&mut self)

Replace the innermost block scope with a fresh copy of its bindings — the per-iteration environment a for (let i …) loop creates, so a closure made in one iteration keeps that iteration’s value.

Source

pub fn scope_snapshot(&self) -> Env

The current block-scope env, for save/restore across a nested chunk.

Source

pub fn restore_scope(&mut self, env: Env)

Source

pub fn set_global(&mut self, name: &str, val: Value)

Source

pub fn begin_capture(&mut self)

Start capturing program output in-process. Any text already captured is discarded, so each run starts clean.

Source

pub fn begin_stdout_capture(&mut self)

Like begin_capture, but only stdout is captured; stderr writes (console.error, process.stderr.write) still reach the process.

Source

pub fn set_stdin(&mut self, input: &[u8])

Make input the program’s standard input: process.stdin, fs.readFileSync(0), fs.readSync(0, …) and readline all read it instead of the process stdin.

Source

pub fn end_capture(&mut self) -> String

Stop capturing and take everything written since begin_capture, returning the empty string when capture was not on. The captured bytes are rendered lossily: this API hands back a String, so a program that wrote non-UTF-8 gets U+FFFD here even though the same write reaches a real stdout byte-exact. Use end_capture_bytes to keep those bytes.

Source

pub fn end_capture_bytes(&mut self) -> Vec<u8> ⓘ

Stop capturing and take the raw bytes, without the lossy transcription end_capture applies.

Source

pub fn capturing(&self) -> bool

Whether output is being captured — the one thing a caller needs to know before asking the real stream a question (isTTY, cursor position).

Source

pub fn write_out(&mut self, s: &str, stderr: bool)

Write program output: into the capture buffer when capturing, else to the process stream stderr selects. s is written verbatim — callers add their own line ending, as console.log does and process.stdout.write does not.

Source

pub fn write_out_bytes(&mut self, bytes: &[u8], stderr: bool)

Write program output as raw BYTES. process.stdout.write(buf) hands Node a byte string and Node writes it through untouched, so a Buffer holding ff fe 41 reaches stdout as those three bytes. Routing it through a Rust String first replaced every non-UTF-8 byte with U+FFFD — three bytes became seven — so the byte path exists separately from write_out.

Source

pub fn del_name(&mut self, name: &str)

Source

pub fn current_this(&self) -> Option<Value>

Source

pub fn this_state(&self) -> ThisState

The running activation’s ThisState.

Source

pub fn mark_next_call_derived_ctor(&mut self)

Mark the next user-function activation as a derived constructor.

Source

pub fn bind_super_this(&mut self) -> bool

BindThisValue (9.1.1.3.1) for a super() that has just returned: the nearest derived-constructor activation becomes Bound. That is the top frame, or — for super() inside an arrow — the constructor below the arrow’s own frame. false when it was already bound: the second call.

Source

pub fn take_super_replacement(&mut self) -> Option<Value>

The object a super() call substituted for the instance, if any.

construct_class allocates the instance up front, so when a base constructor RETURNS an object the substitution happens deep inside the VM, after that allocation. This carries it back out. Each construct_class saves and restores the previous value around its own run, so a new inside a constructor body cannot steal it.

Source

pub fn swap_super_replacement(&mut self, v: Option<Value>) -> Option<Value>

Source

pub fn set_current_this(&mut self, v: Value)

Rebind the running activation’s this.

Only super() does this: when the parent constructor RETURNS an object, 15.7.15 makes that object the derived instance, so the rest of the derived constructor has to write to it rather than to the one allocated before the call.

Source

pub fn has_process_listeners(&self, event: &str) -> bool

The callbacks to run for event, consuming any once registration in the same step — so a listener that re-emits the event cannot re-enter a one-shot handler. Whether any process.on(event) listener is registered.

Source

pub fn take_process_listeners(&mut self, event: &str) -> Vec<Value>

Source

pub fn set_top_this(&mut self, v: Value)

Bind the TOP-LEVEL this — the value a this outside any function sees.

Node answers differently per entry point and both answers are objects: node f.js runs a CommonJS module, so top-level this is module.exports; node -e and node - run a Script, so it is globalThis. Verified on node v26.7.0 — console.log(this === globalThis, this === module.exports) is false true from a file and true false from -e and from stdin. It was undefined at every entry point here, so this.x = 1 at module scope threw instead of populating the exports object.

Only the base frame is touched: a plain function call still gets its own (undefined) binding rather than inheriting this one.

Source

pub fn current_env_capture(&self) -> Env

Source

pub fn current_new_target(&self) -> Option<Value>

Source

pub fn super_home(&self) -> (Option<Value>, bool, Option<Value>)

The running method’s (home_class, is_static, home_object), for the super.x lookup that has to leave the host borrow (see b_super_get).

Source

pub fn super_context(&self) -> (Option<Value>, Vec<(String, Value, bool)>)

The (parent_ctor, this_class_fields) for a running constructor’s super(...), derived from the frame’s home class.

Source

pub fn super_setter(&self, name: &str) -> Option<Option<Value>>

The accessor super.name = v finds: Some(Some(setter)) runs, Some(None) is a getter-only property that refuses the write, and None means no accessor, so the write lands on this as a data property (OrdinarySet with the receiver, 10.1.9.2).

Source

pub fn super_resolve(&self, name: &str) -> SuperRef

Source

pub fn take_error(&mut self) -> Option<String>

Source

pub fn raise_str(&mut self, class: &str, msg: &str) -> String

Source§

impl JsHost

Source

pub fn type_of(&self, v: &Value) -> &'static str

The typeof string for v.

Source

pub fn truthy(&self, v: &Value) -> bool

JS truthiness: false / 0 / -0 / NaN / “” / null / undefined are falsy.

Source

pub fn to_number(&self, v: &Value) -> f64

Coerce to a number (ToNumber): the arithmetic-context conversion.

Source

pub fn str_of(&self, v: &Value) -> String

String(v) — the string-coercion form (raw, unquoted).

Source

pub fn console_format(&self, v: &Value) -> String

console.log-style rendering of a top-level argument: bare strings print raw; everything else uses inspect.

Source

pub fn inspect(&self, v: &Value) -> String

util.inspect-style rendering (nested; strings quoted).

Source

pub fn callable_name(&self, v: &Value) -> String

The .name of any callable (function/class/builtin/bound).

Source

pub fn strict_eq(&self, a: &Value, b: &Value) -> bool

Strict equality (===): same type and same value, no coercion.

Source

pub fn is_nullish(&self, v: &Value) -> bool

Whether v is null or undefined.

Source

pub fn loose_eq(&self, a: &Value, b: &Value) -> bool

Loose equality (==) following the ECMAScript Abstract Equality Comparison. Objects reduce via ToPrimitive (which for our heap objects is always their string toString), so [0] == "0" is true (string compare of "0") but [0] == "" is false — never a number coercion of the object.

Source

pub fn arith( &mut self, op: NumOp, a: &Value, b: &Value, ) -> Result<Value, String>

The numeric-hook arithmetic/relational fallback for non-native operands (called by fusevm when at least one operand isn’t Int/Float).

Source

pub fn bitwise( &mut self, tag: i64, a: &Value, b: &Value, ) -> Result<Value, String>

Bitwise/shift ops with JS ToInt32/ToUint32 semantics — or true arbitrary-width BigInt bitwise when both operands are BigInt (mixing a BigInt with a Number throws, matching Node).

Source

pub fn is_bigint_val(&self, v: &Value) -> bool

Whether v is a heap BigInt.

Source

pub fn as_bigint(&self, v: &Value) -> Option<BigInt>

The BigInt value of v (a heap bigint), else None.

Source

pub fn new_bigint(&mut self, b: BigInt) -> Value

Allocate a heap BigInt.

Source§

impl JsHost

Source

pub fn iter_vec(&mut self, v: &Value) -> Result<Vec<Value>, String>

Collect an iterable into a vector of values (arrays, strings, Map/Set). Generators and user Symbol.iterator objects go through iter_all, which holds no host borrow across resumes.

Source

pub fn enum_keys(&mut self, v: &Value) -> Vec<Value>

Enumerable string keys of an object/array (for for-in). Internal symbol-keyed props (@@…) are not enumerable. for-in visits own enumerable keys, then every inherited enumerable key not already seen, walking the whole prototype chain. Class methods and the builtin prototypes are non-enumerable, so in practice this only surfaces keys a script put on a prototype itself (F.prototype.y = 2) — but that is exactly the constructor-function idiom older packages are written in.

Source

pub fn own_enum_key_names(&self, v: &Value) -> Vec<String>

The own enumerable string keys of v, in property order — the single source of truth behind for-in, Object.keys/values/entries, object spread, Object.assign and JSON.stringify. Internal slots (@@…), private fields (#…) and anything marked non-enumerable via prop_attrs are excluded.

Source

pub fn own_key_names(&self, v: &Value, enum_only: bool) -> Vec<String>

Own string keys of v in insertion order. enum_only drops the non-enumerable ones (Object.keys); otherwise every own key is reported (getOwnPropertyNames/Reflect.ownKeys).

Source

pub fn script_global_names(&self) -> Vec<String>

The keys that own a slot in the object’s property map, in insertion order, resolving accessor ordering markers back to their real key. Every global a SCRIPT created, in creation order — the own enumerable keys of the global object that live in the globals map rather than in its property map. x = 1 with no declaration makes one, and Object.keys(globalThis) reports it in node.

Source

pub fn remove_global(&mut self, name: &str) -> bool

Drop a global a script created. Reports whether it was there.

Source

pub fn own_enum_entries(&self, v: &Value) -> Vec<(String, Value)>

The own enumerable (key, value) pairs of v. Buffer index keys resolve through the byte store; everything else reads the property map. Own accessor keys come back as Undef here — own_enum_entries_deep runs their getters, which cannot happen under the host borrow.

Source§

impl JsHost

Source

pub fn is_generator_val(&self, v: &Value) -> bool

Source

pub fn is_async_gen_val(&self, v: &Value) -> bool

Whether v is an ASYNC generator object — the borrow-free form of is_async_generator, usable from code already holding the host.

Source

pub fn gen_done(&self, id: u32) -> bool

Source§

impl JsHost

Source

pub fn error_to_string(&self, v: &Value) -> Option<String>

Error.prototype.toString for an object whose prototype chain reaches Error.prototype: "Name" with an empty message, else "Name: message". None for anything that is not an error, so the caller keeps its own stringification.

Source§

impl JsHost

Source

pub fn ensure_native_protos(&mut self)

Lazily build the builtin error prototype chain: Error.prototype → Object.prototype, and every specific error’s prototype → Error.prototype. Populated once; instances link to these so e instanceof TypeError and e instanceof Error both hold. The real Buffer.prototype object, building the Buffer.prototype → Uint8Array.prototype → Object.prototype chain on first use.

A Buffer used to be a bare tagged object with no [[Prototype]] at all, so Object.getPrototypeOf(buf) === Buffer.prototype read false and instanceof had to be special-cased around it. Each prototype is a genuine object carrying @proto:<Ctor>:<method> thunks for its instance methods, so Buffer.prototype.slice.call(buf, 1) still dispatches the way it did when Buffer.prototype was a Builtin namespace.

Source

pub fn ensure_function_kind_protos(&mut self)

String.prototype, Number.prototype and Boolean.prototype as REAL objects.

A wrapper built by new String("a") needs a genuine [[Prototype]] link: Builtin("String.prototype") is a thunk namespace that cannot appear on a prototype chain, so Object.getPrototypeOf(w) === String.prototype and w instanceof String both read false while the wrapper’s methods still resolved through the string funnel. Registering them here puts them on the same footing as Buffer.prototype. GeneratorFunction.prototype, AsyncFunction.prototype and AsyncGeneratorFunction.prototype — the intrinsics a generator or async function’s [[Prototype]] really points at.

None are globals (node exposes them only through Object.getPrototypeOf(function*(){}).constructor), so they live here rather than among the wrapper constructors. Each hangs off Function.prototype and carries the Symbol.toStringTag that names it.

Source

pub fn alloc_iter(&mut self, it: JsObj) -> Value

Allocate a built-in iterator (JsObj::Iter) linked to its kind’s intrinsic prototype, so a read, in, instanceof and a patched next all see the chain Object.getPrototypeOf reports.

Source

pub fn iterator_proto_key(&self, v: &Value) -> Option<&'static str>

The ITERATOR_PROTOS key of the intrinsic prototype a built-in iterator inherits from, read with the borrow held. None for anything that is not one of those five iterator kinds.

Source

pub fn ensure_wrapper_protos(&mut self)

Source

pub fn template_object(&self, key: (u64, u64)) -> Option<Value>

The cached template object for one tagged-template site, if it has been evaluated before.

Source

pub fn set_template_object(&mut self, key: (u64, u64), v: Value)

Record the template object for one tagged-template site.

Source

pub fn native_proto(&self, ctor: &str) -> Option<Value>

The real prototype object for a builtin exotic, if it has one.

Source

pub fn intrinsic_proto_ctor(&self, v: &Value) -> Option<&str>

The constructor name whose .prototype object IS v, for a prototype this host built as a real object (String.prototype, TypeError .prototype, Buffer.prototype) rather than as a Builtin namespace.

A prototype is an ORDINARY object: it carries no instance’s internal slot, so Object.prototype.toString.call(TypeError.prototype) is [object Object] and not [object Error]. Nothing distinguished the two before, so the brand fell through to the “does it look like an Error” test and answered for the prototype as if it were an instance.

Source

pub fn ensure_ctor_proto(&mut self, ctor: &str) -> Option<Value>

The real .prototype object for a native stdlib constructor (StringDecoder, Hash, URLSearchParams, …), built on first read and cached.

Ctor.prototype used to read undefined for every native class outside the hand-written is_builtin_ctor list, which broke the ES5 subclassing pattern that libraries still use. iconv-lite’s internal codec — reached from raw-body on every express.json() request — does exactly this:

var StringDecoder = require('string_decoder').StringDecoder;
if (!StringDecoder.prototype.end) StringDecoder.prototype.end = function () {};
function InternalDecoder(options, codec) { StringDecoder.call(this, codec.enc); }
InternalDecoder.prototype = StringDecoder.prototype;

The first line threw Cannot read properties of undefined (reading 'end').

Methods come from stdlib::instance_method_lists, the same table a method READ consults, so the prototype can never advertise a name the dispatcher does not implement. Each is the @proto:<Ctor>:<method> thunk that dispatches against its invoke-time this, so a subclass instance whose prototype IS this object gets the native implementation. Returns None for a tag with no instance methods, leaving those constructors as they were.

Source

pub fn error_proto(&self, name: &str) -> Option<Value>

<ErrorClass>.prototype, once JsHost::ensure_error_protos has run. The error prototypes live in their own table, so ensure_ctor_proto — which answers from native_protos — does not find them.

Source

pub fn ensure_error_protos(&mut self)

Source§

impl JsHost

Source

pub fn func_arity(&self, v: &Value) -> usize

A function’s .length: the count of leading params before the first one with a default or the rest element.

Source

pub fn is_map(&self, v: &Value) -> bool

Source

pub fn is_set(&self, v: &Value) -> bool

Source§

impl JsHost

Source

pub fn new_promise(&mut self) -> Value

Allocate a fresh pending promise, returning its heap value.

Source

pub fn promise_id(&self, v: &Value) -> Option<u32>

Source

pub fn promise_state(&self, id: u32) -> PromiseState

Source

pub fn promise_value(&self, id: u32) -> Value

Source

pub fn promise_mark_handled(&mut self, id: u32)

Source

pub fn take_reactions(&mut self, id: u32) -> Vec<PromiseReaction>

Take the pending reactions of a promise (called on settle).

Source

pub fn add_reaction(&mut self, id: u32, r: PromiseReaction)

Source

pub fn settle_promise(&mut self, id: u32, state: PromiseState, value: Value)

Source

pub fn queue_micro(&mut self, cb: Value, args: Vec<Value>)

Source

pub fn queue_io_callback(&mut self, cb: Value, args: Vec<Value>)

Deliver the callback of an asynchronous I/O operation that has already completed. node-js performs the operation synchronously, but the callback still belongs to the loop’s POLL phase, not to the microtask queue: node runs it as a libuv completion, after the nextTick and promise jobs the starting code queued (fs.stat(f, cb); Promise.resolve().then(p) runs p first) and with a full microtask checkpoint after it.

Source

pub fn queue_io_native(&mut self, f: Box<dyn FnOnce() -> Result<(), String>>)

A native step delivered as an I/O completion, in the same poll-phase queue as JsHost::queue_io_callback (a fs/promises settlement).

Source

pub fn queue_nexttick(&mut self, cb: Value, args: Vec<Value>)

Source

pub fn queue_micro_native(&mut self, f: Box<dyn FnOnce() -> Result<(), String>>)

Schedule a native (Rust) microtask — used by Promise reactions and async resumption.

Source

pub fn add_timer( &mut self, delay: f64, callback: Value, args: Vec<Value>, interval: Option<f64>, ) -> u64

Schedule a macrotask. interval is the repeat period for setInterval (None for the one-shot setTimeout/setImmediate). Returns the timer id, which the Timeout/Immediate handle object carries so clear*, ref/unref and refresh can find this entry again.

Source

pub fn set_timer_refed(&mut self, id: u64, refed: bool)

timeout.ref() / timeout.unref() — set the handle bit on a pending timer. A no-op once the timer has fired or been cleared (Node likewise treats ref/unref on a dead timer as inert).

Source

pub fn timer_has_ref(&self, id: u64) -> bool

timeout.hasRef() — whether a still-pending timer holds the loop open. A fired or cleared timer reports false, matching Node.

Source

pub fn refresh_timer(&mut self, id: u64)

timeout.refresh() — restart the countdown from now, as if the timer had just been scheduled.

Source

pub fn io_sender(&self) -> Sender<IoTask>

Clone the I/O sender for a background I/O thread.

Source

pub fn incr_handle(&mut self)

Register a live handle (listener/socket/ref’d resource) keeping the loop alive.

Source

pub fn decr_handle(&mut self)

Release a handle; the loop exits once this reaches 0 with empty queues.

Source

pub fn open_handles(&self) -> usize

Source

pub fn cancel_timer(&mut self, id: u64)

Trait Implementations§

Source§

impl Default for JsHost

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for JsHost

§

impl !Send for JsHost

§

impl !Sync for JsHost

§

impl !UnwindSafe for JsHost

§

impl Forget for JsHost

§

impl Freeze for JsHost

§

impl Move for JsHost

§

impl Unpin for JsHost

§

impl UnsafeUnpin for JsHost

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> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Conv for T

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

Source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
Source§

impl<T> FmtForward for T

Source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
Source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
Source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
Source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
Source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
Source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
Source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
Source§

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

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
Source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
Source§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
Source§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
Source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more