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-8 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
sourceimpl JsValue
impl JsValue
sourcepub fn get_iterator(
&self,
context: &mut Context,
hint: Option<IteratorHint>,
method: Option<Self>
) -> JsResult<IteratorRecord>
pub fn get_iterator(
&self,
context: &mut Context,
hint: Option<IteratorHint>,
method: Option<Self>
) -> JsResult<IteratorRecord>
sourceimpl JsValue
impl JsValue
sourceimpl JsValue
impl JsValue
sourcepub fn strict_equals(&self, other: &Self) -> bool
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.
sourcepub fn equals(&self, other: &Self, context: &mut Context) -> JsResult<bool>
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
sourcepub fn same_value(x: &Self, y: &Self) -> bool
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:
sourcepub fn same_value_zero(x: &Self, y: &Self) -> bool
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:
sourceimpl JsValue
impl JsValue
pub fn add(&self, other: &Self, context: &mut Context) -> JsResult<Self>
pub fn sub(&self, other: &Self, context: &mut Context) -> JsResult<Self>
pub fn mul(&self, other: &Self, context: &mut Context) -> JsResult<Self>
pub fn div(&self, other: &Self, context: &mut Context) -> JsResult<Self>
pub fn rem(&self, other: &Self, context: &mut Context) -> JsResult<Self>
pub fn pow(&self, other: &Self, context: &mut Context) -> JsResult<Self>
pub fn bitand(&self, other: &Self, context: &mut Context) -> JsResult<Self>
pub fn bitor(&self, other: &Self, context: &mut Context) -> JsResult<Self>
pub fn bitxor(&self, other: &Self, context: &mut Context) -> JsResult<Self>
pub fn shl(&self, other: &Self, context: &mut Context) -> JsResult<Self>
pub fn shr(&self, other: &Self, context: &mut Context) -> JsResult<Self>
pub fn ushr(&self, other: &Self, context: &mut Context) -> JsResult<Self>
pub fn neg(&self, context: &mut Context) -> JsResult<Self>
pub fn not(&self, _: &mut Context) -> JsResult<bool>
sourcepub fn abstract_relation(
&self,
other: &Self,
left_first: bool,
context: &mut Context
) -> JsResult<AbstractRelation>
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:
sourcepub fn lt(&self, other: &Self, context: &mut Context) -> JsResult<bool>
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:
sourcepub fn le(&self, other: &Self, context: &mut Context) -> JsResult<bool>
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:
sourcepub fn gt(&self, other: &Self, context: &mut Context) -> JsResult<bool>
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:
sourceimpl JsValue
impl JsValue
sourcepub fn from_json(json: &Value, context: &mut Context) -> JsResult<Self>
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();
sourcepub fn to_json(&self, context: &mut Context) -> JsResult<Value>
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();
sourceimpl JsValue
impl JsValue
sourcepub fn get_type(&self) -> Type
pub 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.
sourceimpl JsValue
impl JsValue
sourcepub fn positive_infinity() -> Self
pub fn positive_infinity() -> Self
Creates a new number with Infinity
value.
sourcepub fn negative_infinity() -> Self
pub fn negative_infinity() -> Self
Creates a new number with -Infinity
value.
pub fn as_object(&self) -> Option<&JsObject>
sourcepub fn is_callable(&self) -> bool
pub fn is_callable(&self) -> bool
It determines if the value is a callable function with a [[Call]]
internal method.
More information:
pub fn as_callable(&self) -> Option<&JsObject>
sourcepub fn is_constructor(&self) -> bool
pub fn is_constructor(&self) -> bool
Returns true if the value is a constructor object.
pub fn as_constructor(&self) -> Option<&JsObject>
sourcepub fn is_promise(&self) -> bool
pub fn is_promise(&self) -> bool
Returns true if the value is a promise object.
pub fn as_promise(&self) -> Option<&JsObject>
pub fn as_symbol(&self) -> Option<JsSymbol>
sourcepub fn is_undefined(&self) -> bool
pub fn is_undefined(&self) -> bool
Returns true if the value is undefined.
sourcepub fn is_null_or_undefined(&self) -> bool
pub fn is_null_or_undefined(&self) -> bool
Returns true if the value is null or undefined.
sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Returns true if the value is integer.
pub fn as_number(&self) -> Option<f64>
sourcepub fn as_string(&self) -> Option<&JsString>
pub fn as_string(&self) -> Option<&JsString>
Returns the string if the values is a string, otherwise None
.
sourcepub fn is_boolean(&self) -> bool
pub fn is_boolean(&self) -> bool
Returns true if the value is a boolean.
pub fn as_boolean(&self) -> Option<bool>
sourcepub fn as_bigint(&self) -> Option<&JsBigInt>
pub fn as_bigint(&self) -> Option<&JsBigInt>
Returns an optional reference to a BigInt
if the value is a BigInt
primitive.
sourcepub fn to_boolean(&self) -> bool
pub fn to_boolean(&self) -> bool
sourcepub fn set_data(&self, data: ObjectData)
pub fn set_data(&self, data: ObjectData)
Set the kind of an object.
sourcepub fn to_primitive(
&self,
context: &mut Context,
preferred_type: PreferredType
) -> JsResult<Self>
pub fn to_primitive(
&self,
context: &mut Context,
preferred_type: PreferredType
) -> JsResult<Self>
The abstract operation ToPrimitive
takes an input argument and an optional argumenPreferredType
pe.
sourcepub fn display(&self) -> ValueDisplay<'_>
pub 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());
sourcepub fn to_string(&self, context: &mut Context) -> JsResult<JsString>
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.
sourcepub fn to_object(&self, context: &mut Context) -> JsResult<JsObject>
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.
sourcepub fn to_property_key(&self, context: &mut Context) -> JsResult<PropertyKey>
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.
sourcepub fn to_numeric(&self, context: &mut Context) -> JsResult<Numeric>
pub fn to_numeric(&self, context: &mut Context) -> JsResult<Numeric>
It returns value converted to a numeric value of type Number
or BigInt
.
sourcepub fn to_u32(&self, context: &mut Context) -> JsResult<u32>
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
sourcepub fn to_i32(&self, context: &mut Context) -> JsResult<i32>
pub fn to_i32(&self, context: &mut Context) -> JsResult<i32>
Converts a value to an integral 32 bit signed integer.
sourcepub fn to_uint8_clamp(&self, context: &mut Context) -> JsResult<u8>
pub fn to_uint8_clamp(&self, context: &mut Context) -> JsResult<u8>
sourcepub fn to_big_int64(&self, context: &mut Context) -> JsResult<BigInt>
pub fn to_big_int64(&self, context: &mut Context) -> JsResult<BigInt>
sourcepub fn to_big_uint64(&self, context: &mut Context) -> JsResult<BigInt>
pub fn to_big_uint64(&self, context: &mut Context) -> JsResult<BigInt>
sourcepub fn to_index(&self, context: &mut Context) -> JsResult<u64>
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.
sourcepub fn to_length(&self, context: &mut Context) -> JsResult<u64>
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.
sourcepub fn to_integer_or_infinity(
&self,
context: &mut Context
) -> JsResult<IntegerOrInfinity>
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:
sourcepub fn to_number(&self, context: &mut Context) -> JsResult<f64>
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
sourcepub fn to_numeric_number(&self, context: &mut Context) -> JsResult<f64>
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
sourcepub fn require_object_coercible(&self, context: &mut Context) -> JsResult<&Self>
pub fn require_object_coercible(&self, context: &mut Context) -> 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:
pub fn to_property_descriptor(
&self,
context: &mut Context
) -> JsResult<PropertyDescriptor>
Trait Implementations
sourceimpl From<&PropertyKey> for JsValue
impl From<&PropertyKey> for JsValue
sourcefn from(property_key: &PropertyKey) -> Self
fn from(property_key: &PropertyKey) -> Self
sourceimpl From<JsArrayBuffer> for JsValue
impl From<JsArrayBuffer> for JsValue
sourcefn from(o: JsArrayBuffer) -> Self
fn from(o: JsArrayBuffer) -> Self
sourceimpl From<JsFloat32Array> for JsValue
impl From<JsFloat32Array> for JsValue
sourcefn from(o: JsFloat32Array) -> Self
fn from(o: JsFloat32Array) -> Self
sourceimpl From<JsFloat64Array> for JsValue
impl From<JsFloat64Array> for JsValue
sourcefn from(o: JsFloat64Array) -> Self
fn from(o: JsFloat64Array) -> Self
sourceimpl From<JsFunction> for JsValue
impl From<JsFunction> for JsValue
sourcefn from(o: JsFunction) -> Self
fn from(o: JsFunction) -> Self
sourceimpl From<JsInt16Array> for JsValue
impl From<JsInt16Array> for JsValue
sourcefn from(o: JsInt16Array) -> Self
fn from(o: JsInt16Array) -> Self
sourceimpl From<JsInt32Array> for JsValue
impl From<JsInt32Array> for JsValue
sourcefn from(o: JsInt32Array) -> Self
fn from(o: JsInt32Array) -> Self
sourceimpl From<JsInt8Array> for JsValue
impl From<JsInt8Array> for JsValue
sourcefn from(o: JsInt8Array) -> Self
fn from(o: JsInt8Array) -> Self
sourceimpl From<JsMapIterator> for JsValue
impl From<JsMapIterator> for JsValue
sourcefn from(o: JsMapIterator) -> Self
fn from(o: JsMapIterator) -> Self
sourceimpl From<JsSetIterator> for JsValue
impl From<JsSetIterator> for JsValue
sourcefn from(o: JsSetIterator) -> Self
fn from(o: JsSetIterator) -> Self
sourceimpl From<JsTypedArray> for JsValue
impl From<JsTypedArray> for JsValue
sourcefn from(o: JsTypedArray) -> Self
fn from(o: JsTypedArray) -> Self
sourceimpl From<JsUint16Array> for JsValue
impl From<JsUint16Array> for JsValue
sourcefn from(o: JsUint16Array) -> Self
fn from(o: JsUint16Array) -> Self
sourceimpl From<JsUint32Array> for JsValue
impl From<JsUint32Array> for JsValue
sourcefn from(o: JsUint32Array) -> Self
fn from(o: JsUint32Array) -> Self
sourceimpl From<JsUint8Array> for JsValue
impl From<JsUint8Array> for JsValue
sourcefn from(o: JsUint8Array) -> Self
fn from(o: JsUint8Array) -> Self
sourceimpl From<PropertyKey> for JsValue
impl From<PropertyKey> for JsValue
sourcefn from(property_key: PropertyKey) -> Self
fn from(property_key: PropertyKey) -> Self
sourceimpl Trace for JsValue
impl Trace for JsValue
sourcefn finalize_glue(&self)
fn finalize_glue(&self)
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.sourceimpl<T> NativeObject for Twhere
T: Any + Debug + Trace,
impl<T> NativeObject for Twhere
T: Any + Debug + Trace,
sourceimpl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
sourcefn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
sourcefn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresourcefn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresourcefn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
sourcefn 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,
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,
sourcefn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
self
, then passes self.as_ref()
into the pipe function.sourcefn 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,
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,
sourceimpl<T> Tap for T
impl<T> Tap for T
sourcefn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Borrow<B>
of a value. Read moresourcefn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
BorrowMut<B>
of a value. Read moresourcefn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
AsRef<R>
view of a value. Read moresourcefn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
AsMut<R>
view of a value. Read moresourcefn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
Deref::Target
of a value. Read moresourcefn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Deref::Target
of a value. Read moresourcefn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.sourcefn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds. Read moresourcefn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
.tap_borrow()
only in debug builds, and is erased in release
builds. Read moresourcefn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
.tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read moresourcefn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
.tap_ref()
only in debug builds, and is erased in release
builds. Read moresourcefn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
.tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more