Skip to main content

V8Value

Enum V8Value 

Source
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

§source: String

The regexp source (without delimiters).

§flags: u32

V8’s raw flag bits (global=1, ignoreCase=2, multiline=4, …).

§

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)

kNumberObjectnew Number(x).

§

StringObject(String)

kStringObjectnew String(x).

§

BooleanObject(bool)

kTrueObject / kFalseObjectnew Boolean(x).

§

BigIntObject(String)

kBigIntObjectObject(x) of a BigInt, decimal string.

Implementations§

Source§

impl V8Value

Source

pub fn summary(&self) -> String

A short, bounded, human summary of this value’s shape — for the identifier’s candidate summary line.

Trait Implementations§

Source§

impl Clone for V8Value

Source§

fn clone(&self) -> V8Value

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for V8Value

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for V8Value

Source§

fn eq(&self, other: &V8Value) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for V8Value

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for V8Value

Auto Trait Implementations§

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> 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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.