Movatterモバイル変換


[0]ホーム

URL:


Docs.rs

JsValue

StructJsValue 

Source
pub struct JsValue(/* private fields */);
Expand description

A generic JavaScript value. This can be any ECMAScript language valid value.

This is a wrapper around the actual value, which is stored in an opaque type.This allows for internal changes to the value without affecting the public API.

letmutcontext = Context::default();letvalue = JsValue::new(3);assert_eq!(value.to_string(&mutcontext),Ok(js_string!("3")));

Implementations§

Source§

implJsValue

Source

pub fnget_iterator_from_method( &self, method: &JsObject, context: &mutContext,) ->JsResult<IteratorRecord>

GetIteratorFromMethod ( obj, method )

More information:

Source

pub fnget_iterator( &self, hint:IteratorHint, context: &mutContext,) ->JsResult<IteratorRecord>

GetIterator ( obj, kind )

More information:

Source§

implJsValue

Source

pub fnordinary_has_instance( function: &Self, object: &Self, context: &mutContext,) ->JsResult<bool>

Abstract operationOrdinaryHasInstance ( C, O )

More information:

Source§

implJsValue

Source

pub fnfrom_json(json: &Value, context: &mutContext) ->JsResult<Self>

Converts aserde_json::Value to aJsValue.

§Example
useboa_engine::{Context, JsValue};letdata =r#"    {        "name": "John Doe",        "age": 43,        "phones": [            "+44 1234567",            "+44 2345678"        ]     }"#;letjson: serde_json::Value = serde_json::from_str(data).unwrap();letmutcontext = Context::default();letvalue = JsValue::from_json(&json,&mutcontext).unwrap();
Source

pub fnto_json(&self, context: &mutContext) ->JsResult<Option<Value>>

Converts theJsValue to aserde_json::Value.

If theJsValue isUndefined, this method will returnNone.Otherwise it will return the correspondingserde_json::Value.

§Example
useboa_engine::{Context, JsValue};letdata =r#"    {        "name": "John Doe",        "age": 43,        "phones": [            "+44 1234567",            "+44 2345678"        ]     }"#;letjson: serde_json::Value = serde_json::from_str(data).unwrap();letmutcontext = Context::default();letvalue = JsValue::from_json(&json,&mutcontext).unwrap();letback_to_json = value.to_json(&mutcontext).unwrap();
Source§

implJsValue

Source

pub fntry_js_into<T>(&self, context: &mutContext) ->JsResult<T>
where T:TryFromJs,

This function is the inverse ofTryFromJs. It tries to convert aJsValue to a givenRust type.

Source§

implJsValue

Source

pub fndisplay_obj(&self, print_internals:bool) ->String

A helper function for specifically printing object values

Source§

implJsValue

Source

pub fndeep_strict_equals( &self, other: &Self, context: &mutContext,) ->JsResult<bool>

Deep strict equality.

If the value is an object/array, also compare the key-values.It usesstrict_equals() for non-object values.

Source

pub fnstrict_equals(&self, other: &Self) ->bool

Strict equality comparison.

This method is executed when doing strict equality comparisons with the=== operator.For more information, checkhttps://tc39.es/ecma262/#sec-strict-equality-comparison.

Source

pub fnequals(&self, other: &Self, context: &mutContext) ->JsResult<bool>

Abstract equality comparison.

This method is executed when doing abstract equality comparisons with the== operator.For more information, checkhttps://tc39.es/ecma262/#sec-abstract-equality-comparison

Source

pub fnsame_value(x: &Self, y: &Self) ->bool

The internal comparison abstract operation SameValue(x, y),where x and y are ECMAScript language values, produces true or false.

More information:

Source

pub fnsame_value_zero(x: &Self, y: &Self) ->bool

The internal comparison abstract operationSameValueZero(x, y),wherex andy are ECMAScript language values, producestrue orfalse.

SameValueZero differs fromSameValue only in its treatment of+0 and-0.

More information:

Source§

implJsValue

Source

pub fnadd(&self, other: &Self, context: &mutContext) ->JsResult<Self>

Perform the binary+ operator on the value and return the result.

Source

pub fnsub(&self, other: &Self, context: &mutContext) ->JsResult<Self>

Perform the binary- operator on the value and return the result.

Source

pub fnmul(&self, other: &Self, context: &mutContext) ->JsResult<Self>

Perform the binary* operator on the value and return the result.

Source

pub fndiv(&self, other: &Self, context: &mutContext) ->JsResult<Self>

Perform the binary/ operator on the value and return the result.

Source

pub fnrem(&self, other: &Self, context: &mutContext) ->JsResult<Self>

Perform the binary% operator on the value and return the result.

Source

pub fnpow(&self, other: &Self, context: &mutContext) ->JsResult<Self>

Perform the binary** operator on the value and return the result.

Source

pub fnbitand(&self, other: &Self, context: &mutContext) ->JsResult<Self>

Perform the binary& operator on the value and return the result.

Source

pub fnbitor(&self, other: &Self, context: &mutContext) ->JsResult<Self>

Perform the binary| operator on the value and return the result.

Source

pub fnbitxor(&self, other: &Self, context: &mutContext) ->JsResult<Self>

Perform the binary^ operator on the value and return the result.

Source

pub fnshl(&self, other: &Self, context: &mutContext) ->JsResult<Self>

Perform the binary<< operator on the value and return the result.

Source

pub fnshr(&self, other: &Self, context: &mutContext) ->JsResult<Self>

Perform the binary>> operator on the value and return the result.

Source

pub fnushr(&self, other: &Self, context: &mutContext) ->JsResult<Self>

Perform the binary>>> operator on the value and return the result.

Source

pub fninstance_of( &self, target: &Self, context: &mutContext,) ->JsResult<bool>

Abstract operationInstanceofOperator ( V, target )

More information:

Source

pub fnneg(&self, context: &mutContext) ->JsResult<Self>

Returns the negated value.

Source

pub fnnot(&self) ->JsResult<bool>

Returns the negated boolean value.

Source

pub fnabstract_relation( &self, other: &Self, left_first:bool, context: &mutContext,) ->JsResult<AbstractRelation>

Abstract relational comparison

The comparisonx < y, wherex andy are values, producestrue,false,orundefined (which indicates that at least one operand isNaN).

In addition tox andy the algorithm takes a Boolean flag namedLeftFirst as a parameter.The flag is used to control the order in which operations with potentially visible side-effectsare performed uponx andy. It is necessary because ECMAScript specifies left to right evaluationof expressions. The default value ofLeftFirst istrue and indicates that thex parametercorresponds to an expression that occurs to the left of they parameter’s corresponding expression.

IfLeftFirst isfalse, the reverse is the case and operations must be performed upony beforex.

More Information:

Source

pub fnlt(&self, other: &Self, context: &mutContext) ->JsResult<bool>

The less than operator (<) returnstrue if the left operand is less than the right operand,andfalse otherwise.

More Information:

Source

pub fnle(&self, other: &Self, context: &mutContext) ->JsResult<bool>

The less than or equal operator (<=) returnstrue if the left operand is less thanor equal to the right operand, andfalse otherwise.

More Information:

Source

pub fngt(&self, other: &Self, context: &mutContext) ->JsResult<bool>

The greater than operator (>) returnstrue if the left operand is greater thanthe right operand, andfalse otherwise.

More Information:

Source

pub fnge(&self, other: &Self, context: &mutContext) ->JsResult<bool>

The greater than or equal operator (>=) returnstrue if the left operand is greater thanor equal to the right operand, andfalse otherwise.

More Information:

Source§

implJsValue

Source

pub fnget_type(&self) ->Type

Get the type of a value

This is the abstract operation Type(v), as described inhttps://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-ecmascript-language-types.

CheckJsValue::type_of if you need to call thetypeof operator.

Source§

implJsValue

Source

pub fnnew<T>(value: T) -> Self
where T:Into<Self>,

Create a newJsValue.

Source

pub fnvariant(&self) ->JsVariant

Return the variant of this value.

Source

pub const fnundefined() -> Self

Creates a newundefined value.

Source

pub const fnnull() -> Self

Creates a newnull value.

Source

pub const fnnan() -> Self

Creates a new number withNaN value.

Source

pub const fnpositive_infinity() -> Self

Creates a new number withInfinity value.

Source

pub const fnnegative_infinity() -> Self

Creates a new number with-Infinity value.

Source

pub fnrational(rational:f64) -> Self

Creates a new number from a float.

Source

pub fnis_object(&self) ->bool

Returns true if the value is an object.

Source

pub fnas_object(&self) ->Option<JsObject>

Returns the object if the value is object, otherwiseNone.

Source

pub fninto_object(self) ->Option<JsObject>

Consumes the value and return the inner object if it was an object.

Source

pub fnis_callable(&self) ->bool

It determines if the value is a callable function with a[[Call]] internal method.

More information:

Source

pub fnas_callable(&self) ->Option<JsObject>

Returns the callable value if the value is callable, otherwiseNone.

Source

pub fnas_function(&self) ->Option<JsFunction>

Returns aJsFunction if the value is callable, otherwiseNone.This is equivalent toJsFunction::from_object(value.as_callable()?).

Source

pub fnis_constructor(&self) ->bool

Returns true if the value is a constructor object.

Source

pub fnas_constructor(&self) ->Option<JsObject>

Returns the constructor if the value is a constructor, otherwiseNone.

Source

pub fnis_promise(&self) ->bool

Returns true if the value is a promise object.

Source

pub fnas_promise(&self) ->Option<JsPromise>

Returns the value as a promise if the value is a promise, otherwiseNone.

Source

pub fnis_regexp(&self) ->bool

Returns true if the value is a regular expression object.

Source

pub fnas_regexp(&self) ->Option<JsRegExp>

Returns the value as a regular expression if the value is a regexp, otherwiseNone.

Source

pub fnis_symbol(&self) ->bool

Returns true if the value is a symbol.

Source

pub fnas_symbol(&self) ->Option<JsSymbol>

Returns the symbol if the value is a symbol, otherwiseNone.

Source

pub fnis_undefined(&self) ->bool

Returns true if the value is undefined.

Source

pub fnis_null(&self) ->bool

Returns true if the value is null.

Source

pub fnis_null_or_undefined(&self) ->bool

Returns true if the value is null or undefined.

Source

pub fnas_i32(&self) ->Option<i32>

Returns the number if the value is a finite integral Number value, otherwiseNone.

More information:

Source

pub fnis_number(&self) ->bool

Returns true if the value is a number.

Source

pub fnas_number(&self) ->Option<f64>

Returns the number if the value is a number, otherwiseNone.

Source

pub fnis_string(&self) ->bool

Returns true if the value is a string.

Source

pub fnas_string(&self) ->Option<JsString>

Returns the string if the value is a string, otherwiseNone.

Source

pub fnis_boolean(&self) ->bool

Returns true if the value is a boolean.

Source

pub fnas_boolean(&self) ->Option<bool>

Returns the boolean if the value is a boolean, otherwiseNone.

Source

pub fnis_bigint(&self) ->bool

Returns true if the value is a bigint.

Source

pub fnas_bigint(&self) ->Option<JsBigInt>

Returns aBigInt if the value is aBigInt primitive.

Source

pub fnto_boolean(&self) ->bool

Converts the value to abool type.

More information:

Source

pub fnto_primitive( &self, context: &mutContext, preferred_type:PreferredType,) ->JsResult<Self>

The abstract operationToPrimitive takes an input argument and an optional argumentPreferredType.

https://tc39.es/ecma262/#sec-toprimitive

Source

pub fnto_bigint(&self, context: &mutContext) ->JsResult<JsBigInt>

7.1.13 ToBigInt ( argument )

More information:

Source

pub const fndisplay(&self) ->ValueDisplay<'_>

Returns an object that implementsDisplay.

By default, the internals are not shown, but they can be toggledwithValueDisplay::internals method.

§Examples
useboa_engine::JsValue;letvalue = JsValue::new(3);println!("{}", value.display());
Source

pub fnto_string(&self, context: &mutContext) ->JsResult<JsString>

Converts the value to a string.

This function is equivalent toString(value) in JavaScript.

Source

pub fnto_object(&self, context: &mutContext) ->JsResult<JsObject>

Converts the value to an Object.

This function is equivalent toObject(value) in JavaScript.

See:https://tc39.es/ecma262/#sec-toobject

Source

pub fnto_property_key(&self, context: &mutContext) ->JsResult<PropertyKey>

Converts the value to aPropertyKey, that can be used as a key for properties.

Seehttps://tc39.es/ecma262/#sec-topropertykey

Source

pub fnto_numeric(&self, context: &mutContext) ->JsResult<Numeric>

It returns value converted to a numeric value of typeNumber orBigInt.

See:https://tc39.es/ecma262/#sec-tonumeric

Source

pub fnto_u32(&self, context: &mutContext) ->JsResult<u32>

Converts a value to an integral 32-bit unsigned integer.

This function is equivalent tovalue | 0 in JavaScript

See:https://tc39.es/ecma262/#sec-touint32

Source

pub fnto_i32(&self, context: &mutContext) ->JsResult<i32>

Converts a value to an integral 32-bit signed integer.

See:https://tc39.es/ecma262/#sec-toint32

Source

pub fnto_int8(&self, context: &mutContext) ->JsResult<i8>

7.1.10 ToInt8 ( argument )

More information:

Source

pub fnto_uint8(&self, context: &mutContext) ->JsResult<u8>

7.1.11 ToUint8 ( argument )

More information:

Source

pub fnto_uint8_clamp(&self, context: &mutContext) ->JsResult<u8>

7.1.12 ToUint8Clamp ( argument )

More information:

Source

pub fnto_int16(&self, context: &mutContext) ->JsResult<i16>

7.1.8 ToInt16 ( argument )

More information:

Source

pub fnto_uint16(&self, context: &mutContext) ->JsResult<u16>

7.1.9 ToUint16 ( argument )

More information:

Source

pub fnto_big_int64(&self, context: &mutContext) ->JsResult<i64>

7.1.15 ToBigInt64 ( argument )

More information:

Source

pub fnto_big_uint64(&self, context: &mutContext) ->JsResult<u64>

7.1.16 ToBigUint64 ( argument )

More information:

Source

pub fnto_index(&self, context: &mutContext) ->JsResult<u64>

Converts a value to a non-negative integer if it is a valid integer index value.

See:https://tc39.es/ecma262/#sec-toindex

Source

pub fnto_length(&self, context: &mutContext) ->JsResult<u64>

Converts argument to an integer suitable for use as the length of an array-like object.

See:https://tc39.es/ecma262/#sec-tolength

Source

pub fnto_integer_or_infinity( &self, context: &mutContext,) ->JsResult<IntegerOrInfinity>

Abstract operationToIntegerOrInfinity ( argument )

This method converts aValue to an integer representing itsNumber value withfractional part truncated, or to +∞ or -∞ when thatNumber value is infinite.

More information:

Source

pub fnto_number(&self, context: &mutContext) ->JsResult<f64>

Converts a value to a double precision floating point.

This function is equivalent to the unary+ operator (+value) in JavaScript

See:https://tc39.es/ecma262/#sec-tonumber

Source

pub fnto_f16(&self, context: &mutContext) ->JsResult<f16>

Converts a value to a 16-bit floating point.

Source

pub fnto_f32(&self, context: &mutContext) ->JsResult<f32>

Converts a value to a 32 bit floating point.

Source

pub fnto_numeric_number(&self, context: &mutContext) ->JsResult<f64>

This is a more specialized version ofto_numeric, includingBigInt.

This function is equivalent toNumber(value) in JavaScript

See:https://tc39.es/ecma262/#sec-tonumeric

Source

pub fnrequire_object_coercible(&self) ->JsResult<&Self>

Check if theValue can be converted to anObject

The abstract operationRequireObjectCoercible takes argument argument.It throws an error if argument is a value that cannot be converted to an Object usingToObject.It is defined byTable 15

More information:

Source

pub fnto_property_descriptor( &self, context: &mutContext,) ->JsResult<PropertyDescriptor>

The abstract operationToPropertyDescriptor.

More information:

Source

pub fntype_of(&self) -> &'staticstr

typeof operator. Returns a string representing the type of thegiven ECMA Value.

More information:

Source

pub fnjs_type_of(&self) ->JsString

Same asJsValue::type_of, but returning aJsString instead.

Source

pub fnmap<T, F>(&self, f: F) ->Option<T>
where F:FnOnce(&JsValue) -> T,

Maps aJsValue intoOption<T> where T is the result of anoperation on a defined value. If the value isJsValue::undefined,thenJsValue::map will return None.

§Example
useboa_engine::{Context, JsValue};letmutcontext = Context::default();letdefined_value = JsValue::from(5);letundefined = JsValue::undefined();letdefined_result = defined_value    .map(|v| v.add(&JsValue::from(5),&mutcontext))    .transpose()    .unwrap();letundefined_result = undefined    .map(|v| v.add(&JsValue::from(5),&mutcontext))    .transpose()    .unwrap();assert_eq!(defined_result,Some(JsValue::from(10u8)));assert_eq!(undefined_result,None);
Source

pub fnmap_or<T, F>(&self, default: T, f: F) -> T
where F:FnOnce(&JsValue) -> T,

Maps aJsValue intoT where T is the result of anoperation on a defined value. If the value isJsValue::undefined,thenJsValue::map will return the provided default value.

§Example
useboa_engine::{Context, JsValue};letmutcontext = Context::default();letdefined_value = JsValue::from(5);letundefined = JsValue::undefined();letdefined_result = defined_value    .map_or(Ok(JsValue::new(true)), |v| {        v.add(&JsValue::from(5),&mutcontext)    })    .unwrap();letundefined_result = undefined    .map_or(Ok(JsValue::new(true)), |v| {        v.add(&JsValue::from(5),&mutcontext)    })    .unwrap();assert_eq!(defined_result, JsValue::new(10));assert_eq!(undefined_result, JsValue::new(true));

Trait Implementations§

Source§

implClone forJsValue

Source§

fnclone(&self) ->JsValue

Returns a duplicate of the value.Read more
1.0.0 ·Source§

fnclone_from(&mut self, source: &Self)

Performs copy-assignment fromsource.Read more
Source§

implDebug forJsValue

Source§

fnfmt(&self, f: &mutFormatter<'_>) ->Result

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

implDefault forJsValue

Source§

fndefault() -> Self

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

implDrop forJsValue

Source§

fndrop(&mut self)

Executes the destructor for this type.Read more
Source§

implFinalize forJsValue

Source§

fnfinalize(&self)

Cleanup logic for a type.
Source§

implFrom<&PropertyKey> forJsValue

Source§

fnfrom(property_key: &PropertyKey) -> Self

Converts to this type from the input type.
Source§

implFrom<()> forJsValue

Source§

fnfrom(():()) -> Self

Converts to this type from the input type.
Source§

implFrom<GeneratorResumeKind> forJsValue

Source§

fnfrom(value:GeneratorResumeKind) -> Self

Converts to this type from the input type.
Source§

implFrom<JsArray> forJsValue

Source§

fnfrom(o:JsArray) -> Self

Converts to this type from the input type.
Source§

implFrom<JsArrayBuffer> forJsValue

Source§

fnfrom(o:JsArrayBuffer) -> Self

Converts to this type from the input type.
Source§

implFrom<JsBigInt> forJsValue

Source§

fnfrom(value:JsBigInt) -> Self

Converts to this type from the input type.
Source§

implFrom<JsBigInt64Array> forJsValue

Source§

fnfrom(o:JsBigInt64Array) -> Self

Converts to this type from the input type.
Source§

implFrom<JsBigUint64Array> forJsValue

Source§

fnfrom(o:JsBigUint64Array) -> Self

Converts to this type from the input type.
Source§

implFrom<JsDataView> forJsValue

Source§

fnfrom(o:JsDataView) -> Self

Converts to this type from the input type.
Source§

implFrom<JsDate> forJsValue

Source§

fnfrom(o:JsDate) -> Self

Converts to this type from the input type.
Source§

implFrom<JsFloat16Array> forJsValue

Source§

fnfrom(o:JsFloat16Array) -> Self

Converts to this type from the input type.
Source§

implFrom<JsFloat32Array> forJsValue

Source§

fnfrom(o:JsFloat32Array) -> Self

Converts to this type from the input type.
Source§

implFrom<JsFloat64Array> forJsValue

Source§

fnfrom(o:JsFloat64Array) -> Self

Converts to this type from the input type.
Source§

implFrom<JsFunction> forJsValue

Source§

fnfrom(o:JsFunction) -> Self

Converts to this type from the input type.
Source§

implFrom<JsGenerator> forJsValue

Source§

fnfrom(o:JsGenerator) -> Self

Converts to this type from the input type.
Source§

implFrom<JsInt16Array> forJsValue

Source§

fnfrom(o:JsInt16Array) -> Self

Converts to this type from the input type.
Source§

implFrom<JsInt32Array> forJsValue

Source§

fnfrom(o:JsInt32Array) -> Self

Converts to this type from the input type.
Source§

implFrom<JsInt8Array> forJsValue

Source§

fnfrom(o:JsInt8Array) -> Self

Converts to this type from the input type.
Source§

implFrom<JsMap> forJsValue

Source§

fnfrom(o:JsMap) -> Self

Converts to this type from the input type.
Source§

implFrom<JsMapIterator> forJsValue

Source§

fnfrom(o:JsMapIterator) -> Self

Converts to this type from the input type.
Source§

implFrom<JsObject> forJsValue

Source§

fnfrom(object:JsObject) -> Self

Converts to this type from the input type.
Source§

implFrom<JsPromise> forJsValue

Source§

fnfrom(o:JsPromise) -> Self

Converts to this type from the input type.
Source§

implFrom<JsProxy> forJsValue

Source§

fnfrom(o:JsProxy) -> Self

Converts to this type from the input type.
Source§

implFrom<JsRegExp> forJsValue

Source§

fnfrom(o:JsRegExp) -> Self

Converts to this type from the input type.
Source§

implFrom<JsSet> forJsValue

Source§

fnfrom(o:JsSet) -> Self

Converts to this type from the input type.
Source§

implFrom<JsSetIterator> forJsValue

Source§

fnfrom(o:JsSetIterator) -> Self

Converts to this type from the input type.
Source§

implFrom<JsSharedArrayBuffer> forJsValue

Source§

fnfrom(o:JsSharedArrayBuffer) -> Self

Converts to this type from the input type.
Source§

implFrom<JsStr<'_>> forJsValue

Source§

fnfrom(value:JsStr<'_>) -> Self

Converts to this type from the input type.
Source§

implFrom<JsString> forJsValue

Source§

fnfrom(value:JsString) -> Self

Converts to this type from the input type.
Source§

implFrom<JsSymbol> forJsValue

Source§

fnfrom(value:JsSymbol) -> Self

Converts to this type from the input type.
Source§

implFrom<JsTypedArray> forJsValue

Source§

fnfrom(o:JsTypedArray) -> Self

Converts to this type from the input type.
Source§

implFrom<JsUint16Array> forJsValue

Source§

fnfrom(o:JsUint16Array) -> Self

Converts to this type from the input type.
Source§

implFrom<JsUint32Array> forJsValue

Source§

fnfrom(o:JsUint32Array) -> Self

Converts to this type from the input type.
Source§

implFrom<JsUint8Array> forJsValue

Source§

fnfrom(o:JsUint8Array) -> Self

Converts to this type from the input type.
Source§

implFrom<JsUint8ClampedArray> forJsValue

Source§

fnfrom(o:JsUint8ClampedArray) -> Self

Converts to this type from the input type.
Source§

implFrom<JsVariant> forJsValue

Source§

fnfrom(value:JsVariant) -> Self

Converts to this type from the input type.
Source§

implFrom<Numeric> forJsValue

Source§

fnfrom(value:Numeric) -> Self

Converts to this type from the input type.
Source§

implFrom<PropertyKey> forJsValue

Source§

fnfrom(property_key:PropertyKey) -> Self

Converts to this type from the input type.
Source§

impl<A:TryIntoJsArguments, R:TryFromJs>From<TypedJsFunction<A, R>> forJsValue

Source§

fnfrom(o:TypedJsFunction<A, R>) -> Self

Converts to this type from the input type.
Source§

implFrom<bool> forJsValue

Source§

fnfrom(value:bool) -> Self

Converts to this type from the input type.
Source§

implFrom<char> forJsValue

Source§

fnfrom(value:char) -> Self

Converts to this type from the input type.
Source§

implFrom<f32> forJsValue

Source§

fnfrom(value:f32) -> Self

Converts to this type from the input type.
Source§

implFrom<f64> forJsValue

Source§

fnfrom(value:f64) -> Self

Converts to this type from the input type.
Source§

implFrom<i16> forJsValue

Source§

fnfrom(value:i16) -> Self

Converts to this type from the input type.
Source§

implFrom<i32> forJsValue

Source§

fnfrom(value:i32) -> Self

Converts to this type from the input type.
Source§

implFrom<i64> forJsValue

Source§

fnfrom(value:i64) -> Self

Converts to this type from the input type.
Source§

implFrom<i8> forJsValue

Source§

fnfrom(value:i8) -> Self

Converts to this type from the input type.
Source§

implFrom<isize> forJsValue

Source§

fnfrom(value:isize) -> Self

Converts to this type from the input type.
Source§

implFrom<u16> forJsValue

Source§

fnfrom(value:u16) -> Self

Converts to this type from the input type.
Source§

implFrom<u32> forJsValue

Source§

fnfrom(value:u32) -> Self

Converts to this type from the input type.
Source§

implFrom<u64> forJsValue

Source§

fnfrom(value:u64) -> Self

Converts to this type from the input type.
Source§

implFrom<u8> forJsValue

Source§

fnfrom(value:u8) -> Self

Converts to this type from the input type.
Source§

implFrom<usize> forJsValue

Source§

fnfrom(value:usize) -> Self

Converts to this type from the input type.
Source§

implHash forJsValue

Source§

fnhash<H:Hasher>(&self, state:&mut H)

Feeds this value into the givenHasher.Read more
1.3.0 ·Source§

fnhash_slice<H>(data: &[Self], state:&mut H)
where H:Hasher, Self:Sized,

Feeds a slice of this type into the givenHasher.Read more
Source§

implPartialEq forJsValue

Source§

fneq(&self, other: &Self) ->bool

Tests forself andother values to be equal, and is used by==.
1.0.0 ·Source§

fnne(&self, other:&Rhs) ->bool

Tests for!=. The default implementation is almost always sufficient,and should not be overridden without very good reason.
Source§

implTrace forJsValue

Source§

unsafe fntrace(&self, tracer: &mut Tracer)

Marks all containedGcs.Read more
Source§

unsafe fntrace_non_roots(&self)

Trace handles located in GC heap, and mark them as non root.Read more
Source§

fnrun_finalizer(&self)

RunsFinalize::finalize on this object and allcontained subobjects.
Source§

implTryFromJs forJsValue

Source§

fntry_from_js(value: &JsValue, _context: &mutContext) ->JsResult<Self>

This function tries to convert a JavaScript value intoSelf.
Source§

implTryIntoJs forJsValue

Source§

fntry_into_js(&self, _context: &mutContext) ->JsResult<JsValue>

This function tries to convert aSelf intoJsValue.
Source§

implEq forJsValue

Auto Trait Implementations§

§

implFreeze forJsValue

§

impl !RefUnwindSafe forJsValue

§

impl !Send forJsValue

§

impl !Sync forJsValue

§

implUnpin forJsValue

§

impl !UnwindSafe forJsValue

Blanket Implementations§

Source§

impl<T>Any for T
where T: 'static + ?Sized,

Source§

fntype_id(&self) ->TypeId

Gets theTypeId ofself.Read more
Source§

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

Source§

fnborrow(&self) ->&T

Immutably borrows from an owned value.Read more
Source§

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

Source§

fnborrow_mut(&mut self) ->&mut T

Mutably borrows from an owned value.Read more
Source§

impl<T>CloneToUninit for T
where T:Clone,

Source§

unsafe fnclone_to_uninit(&self, dest:*mutu8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment fromself todest.Read more
Source§

impl<T>Conv for T

Source§

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

Convertsself intoT usingInto<T>.Read more
Source§

impl<Q, K>Equivalent<K> for Q
where Q:Eq + ?Sized, K:Borrow<Q> + ?Sized,

Source§

fnequivalent(&self, key:&K) ->bool

Compare self tokey and returntrue if they are equal.
Source§

impl<Q, K>Equivalent<K> for Q
where Q:Eq + ?Sized, K:Borrow<Q> + ?Sized,

Source§

fnequivalent(&self, key:&K) ->bool

Checks if this value is equivalent to the given key.Read more
Source§

impl<T>From<T> for T

Source§

fnfrom(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fninto(self) -> U

CallsU::from(self).

That is, this conversion is whatever the implementation ofFrom<T> for U chooses to do.

Source§

impl<T>IntoEither for T

Source§

fninto_either(self, into_left:bool) ->Either<Self, Self>

Convertsself into aLeft variant ofEither<Self, Self>ifinto_left istrue.Convertsself into aRight variant ofEither<Self, Self>otherwise.Read more
Source§

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

Convertsself into aLeft variant ofEither<Self, Self>ifinto_left(&self) returnstrue.Convertsself into aRight variant ofEither<Self, Self>otherwise.Read more
Source§

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

Source§

fnpipe<R>(self, func: implFnOnce(Self) -> R) -> R
where Self:Sized,

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

fnpipe_ref<'a, R>(&'a self, func: implFnOnce(&'a Self) -> R) -> R
where R: 'a,

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

fnpipe_ref_mut<'a, R>(&'a mut self, func: implFnOnce(&'a mut Self) -> R) -> R
where R: 'a,

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

fnpipe_borrow<'a, B, R>(&'a self, func: implFnOnce(&'a B) -> R) -> R
where Self:Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrowsself, then passesself.borrow() into the pipe function.Read more
Source§

fnpipe_borrow_mut<'a, B, R>( &'a mut self, func: implFnOnce(&'a mut B) -> R,) -> R
where Self:BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrowsself, then passesself.borrow_mut() into the pipefunction.Read more
Source§

fnpipe_as_ref<'a, U, R>(&'a self, func: implFnOnce(&'a U) -> R) -> R
where Self:AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrowsself, then passesself.as_ref() into the pipe function.
Source§

fnpipe_as_mut<'a, U, R>(&'a mut self, func: implFnOnce(&'a mut U) -> R) -> R
where Self:AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrowsself, then passesself.as_mut() into the pipefunction.
Source§

fnpipe_deref<'a, T, R>(&'a self, func: implFnOnce(&'a T) -> R) -> R
where Self:Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrowsself, then passesself.deref() into the pipe function.
Source§

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

Mutably borrowsself, then passesself.deref_mut() into the pipefunction.
Source§

impl<T>Tap for T

Source§

fntap(self, func: implFnOnce(&Self)) -> Self

Immutable access to a value.Read more
Source§

fntap_mut(self, func: implFnOnce(&mut Self)) -> Self

Mutable access to a value.Read more
Source§

fntap_borrow<B>(self, func: implFnOnce(&B)) -> Self
where Self:Borrow<B>, B: ?Sized,

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

fntap_borrow_mut<B>(self, func: implFnOnce(&mut B)) -> Self
where Self:BorrowMut<B>, B: ?Sized,

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

fntap_ref<R>(self, func: implFnOnce(&R)) -> Self
where Self:AsRef<R>, R: ?Sized,

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

fntap_ref_mut<R>(self, func: implFnOnce(&mut R)) -> Self
where Self:AsMut<R>, R: ?Sized,

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

fntap_deref<T>(self, func: implFnOnce(&T)) -> Self
where Self:Deref<Target = T>, T: ?Sized,

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

fntap_deref_mut<T>(self, func: implFnOnce(&mut T)) -> Self
where Self:DerefMut<Target = T> +Deref, T: ?Sized,

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

fntap_dbg(self, func: implFnOnce(&Self)) -> Self

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

fntap_mut_dbg(self, func: implFnOnce(&mut Self)) -> Self

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

fntap_borrow_dbg<B>(self, func: implFnOnce(&B)) -> Self
where Self:Borrow<B>, B: ?Sized,

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

fntap_borrow_mut_dbg<B>(self, func: implFnOnce(&mut B)) -> Self
where Self:BorrowMut<B>, B: ?Sized,

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

fntap_ref_dbg<R>(self, func: implFnOnce(&R)) -> Self
where Self:AsRef<R>, R: ?Sized,

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

fntap_ref_mut_dbg<R>(self, func: implFnOnce(&mut R)) -> Self
where Self:AsMut<R>, R: ?Sized,

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

fntap_deref_dbg<T>(self, func: implFnOnce(&T)) -> Self
where Self:Deref<Target = T>, T: ?Sized,

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

fntap_deref_mut_dbg<T>(self, func: implFnOnce(&mut T)) -> Self
where Self:DerefMut<Target = T> +Deref, T: ?Sized,

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

impl<T>ToOwned for T
where T:Clone,

Source§

typeOwned = T

The resulting type after obtaining ownership.
Source§

fnto_owned(&self) -> T

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

fnclone_into(&self, target:&mut T)

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

impl<T>TryConv for T

Source§

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

Attempts to convertself intoT usingTryInto<T>.Read more
Source§

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

Source§

typeError =Infallible

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

fntry_from(value: U) ->Result<T, <T asTryFrom<U>>::Error>

Performs the conversion.
Source§

impl<'a, T>TryFromJsArgument<'a> for T
where T:TryFromJs,

Source§

fntry_from_js_argument( _: &'aJsValue, rest: &'a [JsValue], context: &mutContext,) ->Result<(T, &'a [JsValue]),JsError>

Try to convert a JS argument into a Rust value, returning thevalue and the rest of the arguments to be parsed.Read more
Source§

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

Source§

typeError = <U asTryFrom<T>>::Error

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

fntry_into(self) ->Result<U, <U asTryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T>TryIntoJsResult for T
where T:TryIntoJs,

Source§

fntry_into_js_result(self, ctx: &mutContext) ->Result<JsValue,JsError>

Try to convert a Rust value into aJsResult<JsValue>.Read more
Source§

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

Source§

fnvzip(self) -> V

Source§

impl<T>ErasedDestructor for T
where T: 'static,


[8]ページ先頭

©2009-2025 Movatter.jp