Enum boa_engine::JsValue

source ·
pub enum JsValue {
    Null,
    Undefined,
    Boolean(bool),
    String(JsString),
    Rational(f64),
    Integer(i32),
    BigInt(JsBigInt),
    Object(JsObject),
    Symbol(JsSymbol),
}
Expand description

A Javascript value

Variants§

§

Null

null - A null value, for when a value doesn’t exist.

§

Undefined

undefined - An undefined value, for when a field or index doesn’t exist.

§

Boolean(bool)

boolean - A true / false value, for if a certain criteria is met.

§

String(JsString)

String - A UTF-16 string, such as "Hello, world".

§

Rational(f64)

Number - A 64-bit floating point number, such as 3.1415

§

Integer(i32)

Number - A 32-bit integer, such as 42.

§

BigInt(JsBigInt)

BigInt - holds any arbitrary large signed integer.

§

Object(JsObject)

Object - An object, such as Math, represented by a binary tree of string keys to Javascript values.

§

Symbol(JsSymbol)

Symbol - A Symbol Primitive type.

Implementations§

source§

impl JsValue

source

pub fn get_iterator( &self, context: &mut Context<'_>, hint: Option<IteratorHint>, method: Option<JsObject> ) -> JsResult<IteratorRecord>

GetIterator ( obj [ , hint [ , method ] ] )

More information:

source§

impl JsValue

source

pub fn ordinary_has_instance( function: &Self, object: &Self, context: &mut Context<'_> ) -> JsResult<bool>

Abstract operation OrdinaryHasInstance ( C, O )

More information:

source§

impl JsValue

source

pub fn from_json(json: &Value, context: &mut Context<'_>) -> JsResult<Self>

Converts a serde_json::Value to a JsValue.

Example
use boa_engine::{Context, JsValue};

let data = r#"
    {
        "name": "John Doe",
        "age": 43,
        "phones": [
            "+44 1234567",
            "+44 2345678"
        ]
     }"#;

let json: serde_json::Value = serde_json::from_str(data).unwrap();

let mut context = Context::default();
let value = JsValue::from_json(&json, &mut context).unwrap();
source

pub fn to_json(&self, context: &mut Context<'_>) -> JsResult<Value>

Converts the JsValue to a serde_json::Value.

Example
use boa_engine::{Context, JsValue};

let data = r#"
    {
        "name": "John Doe",
        "age": 43,
        "phones": [
            "+44 1234567",
            "+44 2345678"
        ]
     }"#;

let json: serde_json::Value = serde_json::from_str(data).unwrap();

let mut context = Context::default();
let value = JsValue::from_json(&json, &mut context).unwrap();

let back_to_json = value.to_json(&mut context).unwrap();
Panics

Panics if the JsValue is Undefined.

source§

impl JsValue

source

pub fn try_js_into<T>(&self, context: &mut Context<'_>) -> JsResult<T>where T: TryFromJs,

This function is the inverse of TryFromJs. It tries to convert a JsValue to a given Rust type.

source§

impl JsValue

source

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

A helper function for specifically printing object values

source§

impl JsValue

source

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

Strict equality comparison.

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

source

pub fn equals(&self, other: &Self, context: &mut Context<'_>) -> JsResult<bool>

Abstract equality comparison.

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

source

pub fn same_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 fn same_value_zero(x: &Self, y: &Self) -> bool

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

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

More information:

source§

impl JsValue

source

pub fn add(&self, other: &Self, context: &mut Context<'_>) -> JsResult<Self>

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

source

pub fn sub(&self, other: &Self, context: &mut Context<'_>) -> JsResult<Self>

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

source

pub fn mul(&self, other: &Self, context: &mut Context<'_>) -> JsResult<Self>

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

source

pub fn div(&self, other: &Self, context: &mut Context<'_>) -> JsResult<Self>

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

source

pub fn rem(&self, other: &Self, context: &mut Context<'_>) -> JsResult<Self>

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

source

pub fn pow(&self, other: &Self, context: &mut Context<'_>) -> JsResult<Self>

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

source

pub fn bitand(&self, other: &Self, context: &mut Context<'_>) -> JsResult<Self>

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

source

pub fn bitor(&self, other: &Self, context: &mut Context<'_>) -> JsResult<Self>

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

source

pub fn bitxor(&self, other: &Self, context: &mut Context<'_>) -> JsResult<Self>

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

source

pub fn shl(&self, other: &Self, context: &mut Context<'_>) -> JsResult<Self>

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

source

pub fn shr(&self, other: &Self, context: &mut Context<'_>) -> JsResult<Self>

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

source

pub fn ushr(&self, other: &Self, context: &mut Context<'_>) -> JsResult<Self>

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

source

pub fn instance_of( &self, target: &Self, context: &mut Context<'_> ) -> JsResult<bool>

Abstract operation InstanceofOperator ( V, target )

More information:

source

pub fn neg(&self, context: &mut Context<'_>) -> JsResult<Self>

Returns the negated value.

source

pub fn not(&self) -> JsResult<bool>

Returns the negated boolean value.

source

pub fn abstract_relation( &self, other: &Self, left_first: bool, context: &mut Context<'_> ) -> JsResult<AbstractRelation>

Abstract relational comparison

The comparison x < y, where x and y are values, produces true, false, or undefined (which indicates that at least one operand is NaN).

In addition to x and y the algorithm takes a Boolean flag named LeftFirst as a parameter. The flag is used to control the order in which operations with potentially visible side-effects are performed upon x and y. It is necessary because ECMAScript specifies left to right evaluation of expressions. The default value of LeftFirst is true and indicates that the x parameter corresponds to an expression that occurs to the left of the y parameter’s corresponding expression.

If LeftFirst is false, the reverse is the case and operations must be performed upon y before x.

More Information:

source

pub fn lt(&self, other: &Self, context: &mut Context<'_>) -> JsResult<bool>

The less than operator (<) returns true if the left operand is less than the right operand, and false otherwise.

More Information:

source

pub fn le(&self, other: &Self, context: &mut Context<'_>) -> JsResult<bool>

The less than or equal operator (<=) returns true if the left operand is less than or equal to the right operand, and false otherwise.

More Information:

source

pub fn gt(&self, other: &Self, context: &mut Context<'_>) -> JsResult<bool>

The greater than operator (>) returns true if the left operand is greater than the right operand, and false otherwise.

More Information:

source

pub fn ge(&self, other: &Self, context: &mut Context<'_>) -> JsResult<bool>

The greater than or equal operator (>=) returns true if the left operand is greater than or equal to the right operand, and false otherwise.

More Information:

source§

impl JsValue

source

pub const fn get_type(&self) -> Type

Get the type of a value

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

Check JsValue::type_of if you need to call the typeof operator.

source§

impl JsValue

source

pub fn new<T>(value: T) -> Selfwhere T: Into<Self>,

Create a new JsValue.

source

pub const fn undefined() -> Self

Creates a new undefined value.

source

pub const fn null() -> Self

Creates a new null value.

source

pub const fn nan() -> Self

Creates a new number with NaN value.

source

pub const fn positive_infinity() -> Self

Creates a new number with Infinity value.

source

pub const fn negative_infinity() -> Self

Creates a new number with -Infinity value.

source

pub const fn is_object(&self) -> bool

Returns true if the value is an object.

source

pub const fn as_object(&self) -> Option<&JsObject>

Returns the object if the value is object, otherwise None.

source

pub fn is_callable(&self) -> bool

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

More information:

source

pub fn as_callable(&self) -> Option<&JsObject>

Returns the callable value if the value is callable, otherwise None.

source

pub fn is_constructor(&self) -> bool

Returns true if the value is a constructor object.

source

pub fn as_constructor(&self) -> Option<&JsObject>

Returns the constructor if the value is a constructor, otherwise None.

source

pub fn is_promise(&self) -> bool

Returns true if the value is a promise object.

source

pub fn as_promise(&self) -> Option<&JsObject>

Returns the promise if the value is a promise, otherwise None.

source

pub const fn is_symbol(&self) -> bool

Returns true if the value is a symbol.

source

pub fn as_symbol(&self) -> Option<JsSymbol>

Returns the symbol if the value is a symbol, otherwise None.

source

pub const fn is_undefined(&self) -> bool

Returns true if the value is undefined.

source

pub const fn is_null(&self) -> bool

Returns true if the value is null.

source

pub const fn is_null_or_undefined(&self) -> bool

Returns true if the value is null or undefined.

source

pub const fn is_double(&self) -> bool

Returns true if the value is a 64-bit floating-point number.

source

pub fn is_integer(&self) -> bool

Returns true if the value is integer.

source

pub const fn is_number(&self) -> bool

Returns true if the value is a number.

source

pub fn as_number(&self) -> Option<f64>

Returns the number if the value is a number, otherwise None.

source

pub const fn is_string(&self) -> bool

Returns true if the value is a string.

source

pub const fn as_string(&self) -> Option<&JsString>

Returns the string if the value is a string, otherwise None.

source

pub const fn is_boolean(&self) -> bool

Returns true if the value is a boolean.

source

pub const fn as_boolean(&self) -> Option<bool>

Returns the boolean if the value is a boolean, otherwise None.

source

pub const fn is_bigint(&self) -> bool

Returns true if the value is a bigint.

source

pub const fn as_bigint(&self) -> Option<&JsBigInt>

Returns an optional reference to a BigInt if the value is a BigInt primitive.

source

pub fn to_boolean(&self) -> bool

Converts the value to a bool type.

More information:

source

pub fn to_primitive( &self, context: &mut Context<'_>, preferred_type: PreferredType ) -> JsResult<Self>

The abstract operation ToPrimitive takes an input argument and an optional argument PreferredType.

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

source

pub fn to_bigint(&self, context: &mut Context<'_>) -> JsResult<JsBigInt>

7.1.13 ToBigInt ( argument )

More information:

source

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

Returns an object that implements Display.

By default the internals are not shown, but they can be toggled with ValueDisplay::internals method.

Examples
use boa_engine::JsValue;

let value = JsValue::new(3);

println!("{}", value.display());
source

pub fn to_string(&self, context: &mut Context<'_>) -> JsResult<JsString>

Converts the value to a string.

This function is equivalent to String(value) in JavaScript.

source

pub fn to_object(&self, context: &mut Context<'_>) -> JsResult<JsObject>

Converts the value to an Object.

This function is equivalent to Object(value) in JavaScript.

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

source

pub fn to_property_key( &self, context: &mut Context<'_> ) -> JsResult<PropertyKey>

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

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

source

pub fn to_numeric(&self, context: &mut Context<'_>) -> JsResult<Numeric>

It returns value converted to a numeric value of type Number or BigInt.

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

source

pub fn to_u32(&self, context: &mut Context<'_>) -> JsResult<u32>

Converts a value to an integral 32 bit unsigned integer.

This function is equivalent to value | 0 in JavaScript

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

source

pub fn to_i32(&self, context: &mut Context<'_>) -> JsResult<i32>

Converts a value to an integral 32 bit signed integer.

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

source

pub fn to_int8(&self, context: &mut Context<'_>) -> JsResult<i8>

7.1.10 ToInt8 ( argument )

More information:

source

pub fn to_uint8(&self, context: &mut Context<'_>) -> JsResult<u8>

7.1.11 ToUint8 ( argument )

More information:

source

pub fn to_uint8_clamp(&self, context: &mut Context<'_>) -> JsResult<u8>

7.1.12 ToUint8Clamp ( argument )

More information:

source

pub fn to_int16(&self, context: &mut Context<'_>) -> JsResult<i16>

7.1.8 ToInt16 ( argument )

More information:

source

pub fn to_uint16(&self, context: &mut Context<'_>) -> JsResult<u16>

7.1.9 ToUint16 ( argument )

More information:

source

pub fn to_big_int64(&self, context: &mut Context<'_>) -> JsResult<BigInt>

7.1.15 ToBigInt64 ( argument )

More information:

source

pub fn to_big_uint64(&self, context: &mut Context<'_>) -> JsResult<BigInt>

7.1.16 ToBigUint64 ( argument )

More information:

source

pub fn to_index(&self, context: &mut Context<'_>) -> 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 fn to_length(&self, context: &mut Context<'_>) -> 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 fn to_integer_or_infinity( &self, context: &mut Context<'_> ) -> JsResult<IntegerOrInfinity>

Abstract operation ToIntegerOrInfinity ( argument )

This method converts a Value to an integer representing its Number value with fractional part truncated, or to +∞ or -∞ when that Number value is infinite.

More information:

source

pub fn to_number(&self, context: &mut Context<'_>) -> 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 fn to_numeric_number(&self, context: &mut Context<'_>) -> JsResult<f64>

This is a more specialized version of to_numeric, including BigInt.

This function is equivalent to Number(value) in JavaScript

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

source

pub fn require_object_coercible(&self) -> JsResult<&Self>

Check if the Value can be converted to an Object

The abstract operation RequireObjectCoercible takes argument argument. It throws an error if argument is a value that cannot be converted to an Object using ToObject. It is defined by Table 15

More information:

source

pub fn to_property_descriptor( &self, context: &mut Context<'_> ) -> JsResult<PropertyDescriptor>

The abstract operation ToPropertyDescriptor.

More information:

source

pub fn type_of(&self) -> &'static str

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

More information:

Trait Implementations§

source§

impl Clone for JsValue

source§

fn clone(&self) -> JsValue

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for JsValue

source§

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

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

impl Default for JsValue

source§

fn default() -> Self

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

impl Finalize for JsValue

source§

fn finalize(&self)

Cleanup logic for a type.
source§

impl From<&PropertyKey> for JsValue

source§

fn from(property_key: &PropertyKey) -> Self

Converts to this type from the input type.
source§

impl From<()> for JsValue

source§

fn from(_: ()) -> Self

Converts to this type from the input type.
source§

impl From<JsArray> for JsValue

source§

fn from(o: JsArray) -> Self

Converts to this type from the input type.
source§

impl From<JsArrayBuffer> for JsValue

source§

fn from(o: JsArrayBuffer) -> Self

Converts to this type from the input type.
source§

impl From<JsBigInt> for JsValue

source§

fn from(value: JsBigInt) -> Self

Converts to this type from the input type.
source§

impl From<JsDataView> for JsValue

source§

fn from(o: JsDataView) -> Self

Converts to this type from the input type.
source§

impl From<JsDate> for JsValue

source§

fn from(o: JsDate) -> Self

Converts to this type from the input type.
source§

impl From<JsFloat32Array> for JsValue

source§

fn from(o: JsFloat32Array) -> Self

Converts to this type from the input type.
source§

impl From<JsFloat64Array> for JsValue

source§

fn from(o: JsFloat64Array) -> Self

Converts to this type from the input type.
source§

impl From<JsFunction> for JsValue

source§

fn from(o: JsFunction) -> Self

Converts to this type from the input type.
source§

impl From<JsGenerator> for JsValue

source§

fn from(o: JsGenerator) -> Self

Converts to this type from the input type.
source§

impl From<JsInt16Array> for JsValue

source§

fn from(o: JsInt16Array) -> Self

Converts to this type from the input type.
source§

impl From<JsInt32Array> for JsValue

source§

fn from(o: JsInt32Array) -> Self

Converts to this type from the input type.
source§

impl From<JsInt8Array> for JsValue

source§

fn from(o: JsInt8Array) -> Self

Converts to this type from the input type.
source§

impl From<JsMap> for JsValue

source§

fn from(o: JsMap) -> Self

Converts to this type from the input type.
source§

impl From<JsMapIterator> for JsValue

source§

fn from(o: JsMapIterator) -> Self

Converts to this type from the input type.
source§

impl From<JsObject> for JsValue

source§

fn from(object: JsObject) -> Self

Converts to this type from the input type.
source§

impl From<JsPromise> for JsValue

source§

fn from(o: JsPromise) -> Self

Converts to this type from the input type.
source§

impl From<JsProxy> for JsValue

source§

fn from(o: JsProxy) -> Self

Converts to this type from the input type.
source§

impl From<JsRegExp> for JsValue

source§

fn from(o: JsRegExp) -> Self

Converts to this type from the input type.
source§

impl From<JsSet> for JsValue

source§

fn from(o: JsSet) -> Self

Converts to this type from the input type.
source§

impl From<JsSetIterator> for JsValue

source§

fn from(o: JsSetIterator) -> Self

Converts to this type from the input type.
source§

impl From<JsSymbol> for JsValue

source§

fn from(value: JsSymbol) -> Self

Converts to this type from the input type.
source§

impl From<JsTypedArray> for JsValue

source§

fn from(o: JsTypedArray) -> Self

Converts to this type from the input type.
source§

impl From<JsUint16Array> for JsValue

source§

fn from(o: JsUint16Array) -> Self

Converts to this type from the input type.
source§

impl From<JsUint32Array> for JsValue

source§

fn from(o: JsUint32Array) -> Self

Converts to this type from the input type.
source§

impl From<JsUint8Array> for JsValue

source§

fn from(o: JsUint8Array) -> Self

Converts to this type from the input type.
source§

impl From<Numeric> for JsValue

source§

fn from(value: Numeric) -> Self

Converts to this type from the input type.
source§

impl From<PropertyKey> for JsValue

source§

fn from(property_key: PropertyKey) -> Self

Converts to this type from the input type.
source§

impl<T> From<T> for JsValuewhere T: Into<JsString>,

source§

fn from(value: T) -> Self

Converts to this type from the input type.
source§

impl From<bool> for JsValue

source§

fn from(value: bool) -> Self

Converts to this type from the input type.
source§

impl From<char> for JsValue

source§

fn from(value: char) -> Self

Converts to this type from the input type.
source§

impl From<f32> for JsValue

source§

fn from(value: f32) -> Self

Converts to this type from the input type.
source§

impl From<f64> for JsValue

source§

fn from(value: f64) -> Self

Converts to this type from the input type.
source§

impl From<i16> for JsValue

source§

fn from(value: i16) -> Self

Converts to this type from the input type.
source§

impl From<i32> for JsValue

source§

fn from(value: i32) -> Self

Converts to this type from the input type.
source§

impl From<i64> for JsValue

source§

fn from(value: i64) -> Self

Converts to this type from the input type.
source§

impl From<i8> for JsValue

source§

fn from(value: i8) -> Self

Converts to this type from the input type.
source§

impl From<u16> for JsValue

source§

fn from(value: u16) -> Self

Converts to this type from the input type.
source§

impl From<u32> for JsValue

source§

fn from(value: u32) -> Self

Converts to this type from the input type.
source§

impl From<u64> for JsValue

source§

fn from(value: u64) -> Self

Converts to this type from the input type.
source§

impl From<u8> for JsValue

source§

fn from(value: u8) -> Self

Converts to this type from the input type.
source§

impl From<usize> for JsValue

source§

fn from(value: usize) -> Self

Converts to this type from the input type.
source§

impl Hash for JsValue

source§

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

Feeds this value into the given Hasher. Read more
1.3.0 · source§

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

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq<JsValue> for JsValue

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Trace for JsValue

source§

unsafe fn trace(&self)

Marks all contained Gcs. Read more
source§

unsafe fn root(&self)

Increments the root-count of all contained Gcs. Read more
source§

unsafe fn unroot(&self)

Decrements the root-count of all contained Gcs. Read more
source§

fn run_finalizer(&self)

Runs Finalize::finalize on this object and all contained subobjects.
source§

impl TryFromJs for JsValue

source§

fn try_from_js(value: &JsValue, _context: &mut Context<'_>) -> JsResult<Self>

This function tries to convert a JavaScript value into Self.
source§

impl Eq for JsValue

Auto Trait Implementations§

§

impl !RefUnwindSafe for JsValue

§

impl !Send for JsValue

§

impl !Sync for JsValue

§

impl Unpin for JsValue

§

impl !UnwindSafe for JsValue

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CallHasher for Twhere T: Hash + ?Sized,

§

default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64where H: Hash + ?Sized, B: BuildHasher,

source§

impl<T> Conv for T

source§

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

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

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

§

fn equivalent(&self, key: &K) -> bool

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

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

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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> NativeObject for Twhere T: Any + Trace,

source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert the Rust type which implements NativeObject to a &dyn Any.
source§

fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)

Convert the Rust type which implements NativeObject to a &mut dyn Any.
source§

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

source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere 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) -> Rwhere 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) -> Rwhere 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) -> Rwhere 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 ) -> Rwhere 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) -> Rwhere 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) -> Rwhere 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) -> Rwhere 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 ) -> Rwhere 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> 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)) -> Selfwhere 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)) -> Selfwhere 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)) -> Selfwhere 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)) -> Selfwhere 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)) -> Selfwhere 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)) -> Selfwhere 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)) -> Selfwhere 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)) -> Selfwhere 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)) -> Selfwhere 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)) -> Selfwhere 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)) -> Selfwhere 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)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,

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

impl<T> ToOwned for Twhere T: Clone,

§

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> 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

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

§

fn vzip(self) -> V

§

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