Skip to main content

SafeInteger

Struct SafeInteger 

Source
pub struct SafeInteger<T: SafeIntegerPrimitive>(/* private fields */);
Expand description

A u64 or i64 that crosses the JS boundary as a number instead of a BigInt.

Many JS APIs type integer counts as number. A plain u64 in a binding signature is a BigInt at the boundary, so SafeInteger<u64> is used instead to keep the Rust integer type while passing a number. In TypeScript it is number.

ⓘ
use wasm_bindgen::SafeInteger;

#[wasm_bindgen]
extern "C" {
    type QueueMetrics;
    #[wasm_bindgen(method, getter, js_name = backlogCount)]
    fn backlog_count(this: &QueueMetrics) -> SafeInteger<u64>;
}

let count = metrics.backlog_count();
if count > 10_000 { /* ... */ }
let next: u64 = (count + 1).into();

It derefs to the inner integer, so its methods are available directly, and compares and does arithmetic with both itself and the inner type.

The value is expected to be within ±(2^53 - 1) (Number.MAX_SAFE_INTEGER) and, for u64, non-negative, so that it is exactly representable as a JS number. Like the overflow checks on Rust’s own integers, this is only checked with debug assertions enabled: constructing a value out of range, arithmetic leaving the range, or receiving a non-integer or out-of-range number from JS then panics. Without debug assertions an out-of-range value converts lossily, as an as cast would. SafeInteger::new and the TryFrom<JsValue> conversion always check.

SafeInteger is supported in every position its conversion is reached through: arguments and returns, catch results, Option, Vec and Box<[_]>, borrowed slices passed into Rust, closure arguments, async import results and generic positions on experimental_generic_mono imports. A borrowed slice &[SafeInteger<_>] cannot be passed out to JS, since the elements have to be converted; pass a Vec or Box<[_]> instead.

Implementations§

Source§

impl<T: SafeIntegerPrimitive> SafeInteger<T>

Source

pub const MAX: Self

The largest safe integer, 2^53 - 1 (Number.MAX_SAFE_INTEGER).

Source

pub const MIN: Self

The smallest safe integer: 0 for u64, -(2^53 - 1) (Number.MIN_SAFE_INTEGER) for i64.

Source

pub fn new(value: T) -> Option<Self>

Wraps value, returning None if it is out of the safe integer range.

Trait Implementations§

Source§

impl<T: SafeIntegerPrimitive + Add<Output = T>> Add for SafeInteger<T>

Source§

type Output = SafeInteger<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
Source§

impl<T: SafeIntegerPrimitive + Add<Output = T>> Add<T> for SafeInteger<T>

Source§

type Output = SafeInteger<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: T) -> Self

Performs the + operation. Read more
Source§

impl<T: SafeIntegerPrimitive + Add<Output = T>> AddAssign for SafeInteger<T>

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl<T: SafeIntegerPrimitive + Add<Output = T>> AddAssign<T> for SafeInteger<T>

Source§

fn add_assign(&mut self, rhs: T)

Performs the += operation. Read more
Source§

impl<T: Clone + SafeIntegerPrimitive> Clone for SafeInteger<T>

Source§

fn clone(&self) -> Self

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<T: Copy + SafeIntegerPrimitive> Copy for SafeInteger<T>

Source§

impl<T: SafeIntegerPrimitive + Debug> Debug for SafeInteger<T>

Source§

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

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

impl<T: Default + SafeIntegerPrimitive> Default for SafeInteger<T>

Source§

fn default() -> Self

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

impl<T: SafeIntegerPrimitive> Deref for SafeInteger<T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
Source§

impl<T: SafeIntegerPrimitive + Display> Display for SafeInteger<T>

Source§

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

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

impl<T: SafeIntegerPrimitive + Div<Output = T>> Div for SafeInteger<T>

Source§

type Output = SafeInteger<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self

Performs the / operation. Read more
Source§

impl<T: SafeIntegerPrimitive + Div<Output = T>> Div<T> for SafeInteger<T>

Source§

type Output = SafeInteger<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> Self

Performs the / operation. Read more
Source§

impl<T: SafeIntegerPrimitive + Div<Output = T>> DivAssign for SafeInteger<T>

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
Source§

impl<T: SafeIntegerPrimitive + Div<Output = T>> DivAssign<T> for SafeInteger<T>

Source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
Source§

impl<T: Eq + SafeIntegerPrimitive> Eq for SafeInteger<T>

Source§

impl<T: SafeIntegerPrimitive> ErasableGeneric for SafeInteger<T>

Source§

type Repr = SafeInteger<T>

The singular concrete type that all generic variants can be transmuted on. Read more
Source§

impl<T: SafeIntegerPrimitive> From<SafeInteger<T>> for JsValue

Source§

fn from(n: SafeInteger<T>) -> JsValue

Converts to this type from the input type.
Source§

impl From<SafeInteger<i64>> for i64

Source§

fn from(value: SafeInteger<i64>) -> i64

Converts to this type from the input type.
Source§

impl From<SafeInteger<u64>> for u64

Source§

fn from(value: SafeInteger<u64>) -> u64

Converts to this type from the input type.
Source§

impl<T: SafeIntegerPrimitive> From<T> for SafeInteger<T>

Source§

fn from(value: T) -> Self

Converts to this type from the input type.
Source§

impl<T: SafeIntegerPrimitive> FromWasmAbi for SafeInteger<T>

Source§

type Abi = f64

The Wasm ABI type that this converts from when coming back out from the ABI boundary.
Source§

unsafe fn from_abi(js: f64) -> Self

Recover a Self from Self::Abi. Read more
Source§

impl<T: Hash + SafeIntegerPrimitive> Hash for SafeInteger<T>

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<T: SafeIntegerPrimitive> IntoWasmAbi for SafeInteger<T>

Source§

type Abi = f64

The Wasm ABI type that this converts into when crossing the ABI boundary.
Source§

fn into_abi(self) -> f64

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
Source§

impl<T: SafeIntegerPrimitive> IntoWasmAbi for &SafeInteger<T>

Source§

type Abi = f64

The Wasm ABI type that this converts into when crossing the ABI boundary.
Source§

fn into_abi(self) -> f64

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
Source§

impl<T: SafeIntegerPrimitive> MaybeFromWasmAbi for SafeInteger<T>

Source§

type MaybeAbi = <f64 as MaybeFromWasmAbi>::MaybeAbi

The ABI of Option<Self>.
Source§

unsafe fn from_maybe_abi(js: Self::MaybeAbi) -> Self

Recovers a value from the Option<Self> ABI, once is_none has ruled None out. Read more
Source§

fn is_none(js: &Self::MaybeAbi) -> bool

Tests the ABI value for None.
Source§

impl<T: SafeIntegerPrimitive> MaybeIntoWasmAbi for SafeInteger<T>

Source§

type MaybeAbi = <f64 as MaybeIntoWasmAbi>::MaybeAbi

The ABI of Option<Self>.
Source§

fn into_maybe_abi(self) -> Self::MaybeAbi

Converts a value into the Option<Self> ABI.
Source§

fn none() -> Self::MaybeAbi

Returns the ABI value for None, which JS reads as undefined. Read more
Source§

impl<T: SafeIntegerPrimitive> MaybeIntoWasmAbi for &SafeInteger<T>

Source§

type MaybeAbi = <f64 as MaybeIntoWasmAbi>::MaybeAbi

The ABI of Option<Self>.
Source§

fn into_maybe_abi(self) -> Self::MaybeAbi

Converts a value into the Option<Self> ABI.
Source§

fn none() -> Self::MaybeAbi

Returns the ABI value for None, which JS reads as undefined. Read more
Source§

impl<T: SafeIntegerPrimitive + Mul<Output = T>> Mul for SafeInteger<T>

Source§

type Output = SafeInteger<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self

Performs the * operation. Read more
Source§

impl<T: SafeIntegerPrimitive + Mul<Output = T>> Mul<T> for SafeInteger<T>

Source§

type Output = SafeInteger<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Self

Performs the * operation. Read more
Source§

impl<T: SafeIntegerPrimitive + Mul<Output = T>> MulAssign for SafeInteger<T>

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl<T: SafeIntegerPrimitive + Mul<Output = T>> MulAssign<T> for SafeInteger<T>

Source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
Source§

impl Neg for SafeInteger<i64>

Source§

type Output = SafeInteger<i64>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<T: SafeIntegerPrimitive> NullableFromWasmAbi for SafeInteger<T>

Source§

fn is_null(js: &Self::MaybeAbi) -> bool

Tests the ABI value for Nullable::Null.
Source§

impl<T: SafeIntegerPrimitive> NullableIntoWasmAbi for SafeInteger<T>

Source§

fn null() -> Self::MaybeAbi

Returns the ABI value for Nullable::Null, which JS reads as null. Read more
Source§

impl<T: SafeIntegerPrimitive> NullableIntoWasmAbi for &SafeInteger<T>

Source§

fn null() -> Self::MaybeAbi

Returns the ABI value for Nullable::Null, which JS reads as null. Read more
Source§

impl<T: Ord + SafeIntegerPrimitive> Ord for SafeInteger<T>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl<T: PartialEq + SafeIntegerPrimitive> PartialEq for SafeInteger<T>

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl<T: SafeIntegerPrimitive> PartialEq<SafeInteger<T>> for JsValue

Source§

fn eq(&self, other: &SafeInteger<T>) -> bool

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

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

Inequality operator !=. Read more
Source§

impl PartialEq<SafeInteger<i64>> for i64

Source§

fn eq(&self, other: &SafeInteger<i64>) -> bool

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

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

Inequality operator !=. Read more
Source§

impl PartialEq<SafeInteger<u64>> for u64

Source§

fn eq(&self, other: &SafeInteger<u64>) -> bool

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

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

Inequality operator !=. Read more
Source§

impl<T: SafeIntegerPrimitive> PartialEq<T> for SafeInteger<T>

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl<T: PartialOrd + SafeIntegerPrimitive> PartialOrd for SafeInteger<T>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<SafeInteger<i64>> for i64

Source§

fn partial_cmp(&self, other: &SafeInteger<i64>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<SafeInteger<u64>> for u64

Source§

fn partial_cmp(&self, other: &SafeInteger<u64>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T: SafeIntegerPrimitive> PartialOrd<T> for SafeInteger<T>

Source§

fn partial_cmp(&self, other: &T) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T: SafeIntegerPrimitive> Promising for SafeInteger<T>

Source§

type Resolution = SafeInteger<T>

The type that this value resolves to.
Source§

impl<T: SafeIntegerPrimitive + Rem<Output = T>> Rem for SafeInteger<T>

Source§

type Output = SafeInteger<T>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Self) -> Self

Performs the % operation. Read more
Source§

impl<T: SafeIntegerPrimitive + Rem<Output = T>> Rem<T> for SafeInteger<T>

Source§

type Output = SafeInteger<T>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: T) -> Self

Performs the % operation. Read more
Source§

impl<T: SafeIntegerPrimitive + Rem<Output = T>> RemAssign for SafeInteger<T>

Source§

fn rem_assign(&mut self, rhs: Self)

Performs the %= operation. Read more
Source§

impl<T: SafeIntegerPrimitive + Rem<Output = T>> RemAssign<T> for SafeInteger<T>

Source§

fn rem_assign(&mut self, rhs: T)

Performs the %= operation. Read more
Source§

impl<T: PartialEq + SafeIntegerPrimitive> StructuralPartialEq for SafeInteger<T>

Source§

impl<T: SafeIntegerPrimitive + Sub<Output = T>> Sub for SafeInteger<T>

Source§

type Output = SafeInteger<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
Source§

impl<T: SafeIntegerPrimitive + Sub<Output = T>> Sub<T> for SafeInteger<T>

Source§

type Output = SafeInteger<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: T) -> Self

Performs the - operation. Read more
Source§

impl<T: SafeIntegerPrimitive + Sub<Output = T>> SubAssign for SafeInteger<T>

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl<T: SafeIntegerPrimitive + Sub<Output = T>> SubAssign<T> for SafeInteger<T>

Source§

fn sub_assign(&mut self, rhs: T)

Performs the -= operation. Read more
Source§

impl<T: SafeIntegerPrimitive> TryFrom<&JsValue> for SafeInteger<T>

Source§

type Error = JsValue

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

fn try_from(value: &JsValue) -> Result<Self, JsValue>

Performs the conversion.
Source§

impl<T: SafeIntegerPrimitive> TryFrom<JsValue> for SafeInteger<T>

Source§

type Error = JsValue

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

fn try_from(value: JsValue) -> Result<Self, JsValue>

Performs the conversion.
Source§

impl<T: SafeIntegerPrimitive> TryFromJsValue for SafeInteger<T>

Source§

fn try_from_js_value_ref(value: &JsValue) -> Option<Self>

Performs the conversion.
Source§

const NULLABLE: bool = false

Whether Self accepts null as a distinct value space, as Nullable<T> does. An enclosing Option then passes null through instead of reading it as None, so Option<T> is itself nullable exactly when T is not. JsValue does not set this: it accepts null as one value among all of them, not as a distinct space, and Option<JsValue> reads it as None like the ABI does. This is the JS-value side of NullableFromWasmAbi, which claims null at the ABI.
Source§

fn try_from_js_value(value: JsValue) -> Result<Self, JsValue>

Performs the conversion.
Source§

impl<T: SafeIntegerPrimitive> UpcastFrom<SafeInteger<T>> for SafeInteger<T>

Source§

impl<T: SafeIntegerPrimitive> UpcastFrom<SafeInteger<T>> for f64

Source§

impl<T: SafeIntegerPrimitive> UpcastFrom<SafeInteger<T>> for JsOption<f64>

Source§

impl<T: SafeIntegerPrimitive> UpcastFrom<SafeInteger<T>> for JsNullable<f64>

Source§

impl<T: SafeIntegerPrimitive> UpcastFrom<SafeInteger<T>> for JsValue

Source§

impl<T: SafeIntegerPrimitive> UpcastFrom<SafeInteger<T>> for JsOption<JsValue>

Source§

impl<T: SafeIntegerPrimitive> UpcastFrom<SafeInteger<T>> for JsNullable<JsValue>

Source§

impl<T: SafeIntegerPrimitive, Target: UpcastFrom<SafeInteger<T>>> UpcastFrom<SafeInteger<T>> for Option<Target>

Source§

impl<T: SafeIntegerPrimitive, Target: UpcastFrom<SafeInteger<T>>> UpcastFrom<SafeInteger<T>> for Nullable<Target>

Source§

impl<T: SafeIntegerPrimitive> VectorFromWasmAbi for SafeInteger<T>

Source§

impl<T: SafeIntegerPrimitive> VectorIntoWasmAbi for SafeInteger<T>

Auto Trait Implementations§

§

impl<T> Freeze for SafeInteger<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for SafeInteger<T>
where T: RefUnwindSafe,

§

impl<T> Send for SafeInteger<T>
where T: Send,

§

impl<T> Sync for SafeInteger<T>
where T: Sync,

§

impl<T> Unpin for SafeInteger<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for SafeInteger<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for SafeInteger<T>
where T: UnwindSafe,

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, A> RefIntoWasmAbi for T
where A: WasmAbi, &'a T: for<'a> IntoWasmAbi<Abi = A>, T: ?Sized,

Source§

type Abi = A

The Wasm ABI type that &Self converts into.
Source§

fn describe_ref()

Describe &Self.
Source§

fn ref_into_abi(&self) -> A

Convert &self into Self::Abi.
Source§

impl<T> ReturnWasmAbi for T
where T: IntoWasmAbi,

Source§

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi
Source§

fn return_abi(self) -> <T as ReturnWasmAbi>::Abi

Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = <Self as ErasableGeneric>::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = <Self as ErasableGeneric>::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more