pub enum ObjKind {
Show 16 variants
Plain,
Array(Vec<Value>),
Function(FunctionData),
Native {
name: String,
func: NativeFn,
},
Bytes(ByteStore),
DomElement(usize),
Host(String),
MapObj(Vec<(Value, Value)>),
SetObj(Vec<Value>),
PromiseObj(Rc<RefCell<PromiseState>>),
Resolver {
state: Rc<RefCell<PromiseState>>,
reject: bool,
},
Generator(Rc<RefCell<GenState>>),
RegExpObj(Rc<RefCell<RegExpData>>),
Proxy {
target: ObjRef,
handler: ObjRef,
},
Bound {
target: Value,
bound_this: Value,
bound_args: Vec<Value>,
},
DateObj(f64),
}Variants§
Plain
Array(Vec<Value>)
Function(FunctionData)
Native
Bytes(ByteStore)
1 バイト型の TypedArray(Uint8Array / Int8Array / Uint8ClampedArray)。実バイト列を
共有の記憶域に持つ(subarray・.buffer・DataView が同じ記憶域を指す)。
【2026-10-18】従来は ObjKind::Array(要素ごとに Value)を流用しており、1 バイトに
16 バイト以上使い、subarray も複写だったため、YouTube の動画データ(数百 KB〜MB)の
解析でヒープが尽きた。
DomElement(usize)
DOM 要素ハンドル(DOMアリーナのノード index を保持)。
Host(String)
document などのホストオブジェクト識別子。
MapObj(Vec<(Value, Value)>)
Map: 挿入順を保つ (key, value) リスト(キー等価は SameValueZero 近似)。
SetObj(Vec<Value>)
Set: 挿入順を保つ値リスト。
PromiseObj(Rc<RefCell<PromiseState>>)
Promise。状態は共有可変(then/await で参照される)。
Resolver
resolve/reject 関数(Promise 状態を束縛したクロージャ相当)。
Generator(Rc<RefCell<GenState>>)
Generator(遅延評価。resume のたびに本体を replay して次の yield まで進める)。
RegExpObj(Rc<RefCell<RegExpData>>)
RegExp(コンパイル済みパターン + lastIndex)。
Proxy
Proxy(target とハンドラ。トラップ未定義時は target にフォワード)。
Bound
Function.prototype.bind() が返す束縛済み関数。呼び出し時は
bound_args ++ 実引数 を bound_this を this として target に渡す。
DateObj(f64)
Date。内部値は UTC エポックミリ秒(不正な日時は f64::NAN。仕様の Invalid Date 相当)。
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ObjKind
impl !Send for ObjKind
impl !Sync for ObjKind
impl !UnwindSafe for ObjKind
impl Freeze for ObjKind
impl Unpin for ObjKind
impl UnsafeUnpin for ObjKind
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