pub enum V8Value {
Show 19 variants
Undefined,
Null,
Hole,
Bool(bool),
Int(i64),
Double(f64),
BigInt(String),
String(String),
Date(f64),
RegExp {
source: String,
flags: u32,
},
Array(Vec<V8Value>),
Object(Vec<(String, V8Value)>),
Map(Vec<(V8Value, V8Value)>),
Set(Vec<V8Value>),
ArrayBuffer(Vec<u8>),
NumberObject(f64),
StringObject(String),
BooleanObject(bool),
BigIntObject(String),
}Expand description
A decoded V8 / Blink structured-clone value.
Numeric JS values split by their wire encoding: V8Value::Int for the
zig-zag kInt32 / kUint32 tags, V8Value::Double for kDouble (which V8
also uses for any integer outside i32 range). BigInt is rendered to a
decimal string. Boxed primitives (new Number(7), new String('x'),
new Boolean(true)) keep their wrapper identity so the reading is faithful.
Variants§
Undefined
kUndefined (_).
Null
kNull (0).
Hole
kTheHole (-) — an absent element in a sparse/holey array.
Bool(bool)
kTrue / kFalse.
Int(i64)
kInt32 (zig-zag) or kUint32.
Double(f64)
kDouble — an IEEE-754 double (also used for integers outside i32).
BigInt(String)
kBigInt, rendered to its decimal string (e.g. "-42").
String(String)
kUtf8String / kOneByteString (Latin-1) / kTwoByteString (UTF-16LE).
Date(f64)
kDate — milliseconds since the Unix epoch.
RegExp
kRegExp — the source pattern plus V8’s raw flag bitset.
Fields
Array(Vec<V8Value>)
kBeginDenseJSArray / kBeginSparseJSArray — holes are V8Value::Hole.
Object(Vec<(String, V8Value)>)
kBeginJSObject — properties in serialized (insertion) order.
Map(Vec<(V8Value, V8Value)>)
kBeginJSMap — key/value pairs in insertion order.
Set(Vec<V8Value>)
kBeginJSSet — members in insertion order.
ArrayBuffer(Vec<u8>)
kArrayBuffer — the raw bytes.
NumberObject(f64)
kNumberObject — new Number(x).
StringObject(String)
kStringObject — new String(x).
BooleanObject(bool)
kTrueObject / kFalseObject — new Boolean(x).
BigIntObject(String)
kBigIntObject — Object(x) of a BigInt, decimal string.