Skip to main content

MaybeIntoWasmAbi

Trait MaybeIntoWasmAbi 

Source
pub trait MaybeIntoWasmAbi: IntoWasmAbi {
    type MaybeAbi: WasmAbi;

    // Required methods
    fn into_maybe_abi(self) -> Self::MaybeAbi;
    fn none() -> Self::MaybeAbi;
}
Expand description

The ABI of Option<Self>.

Option<T> takes its conversion from this trait, so every T implementing it can be wrapped, including under a generic bound such as Option<impl JsNumberOrStringLike>. A type whose own ABI has a spare value for None implements OptionIntoWasmAbi instead and gets this trait from the blanket impl; a type without one, such as i32 or f64, picks a wider MaybeAbi here.

§⚠️ Unstable

This is part of the internal convert module, no stability guarantees are provided. Use at your own risk. See its documentation for more details.

Required Associated Types§

Source

type MaybeAbi: WasmAbi

The ABI of Option<Self>.

Required Methods§

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.

It should be guaranteed that into_maybe_abi can never produce this value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl MaybeIntoWasmAbi for f32

Source§

impl MaybeIntoWasmAbi for f64

Source§

type MaybeAbi = MaybeAbi<f64>

Source§

fn into_maybe_abi(self) -> MaybeAbi<f64>

Source§

fn none() -> MaybeAbi<f64>

Source§

impl MaybeIntoWasmAbi for i32

Source§

impl MaybeIntoWasmAbi for i64

Source§

type MaybeAbi = MaybeAbi<i64>

Source§

fn into_maybe_abi(self) -> MaybeAbi<i64>

Source§

fn none() -> MaybeAbi<i64>

Source§

impl MaybeIntoWasmAbi for i128

Source§

type MaybeAbi = MaybeAbi<i128>

Source§

fn into_maybe_abi(self) -> MaybeAbi<i128>

Source§

fn none() -> MaybeAbi<i128>

Source§

impl MaybeIntoWasmAbi for isize

Source§

impl MaybeIntoWasmAbi for u32

Source§

impl MaybeIntoWasmAbi for u64

Source§

type MaybeAbi = MaybeAbi<u64>

Source§

fn into_maybe_abi(self) -> MaybeAbi<u64>

Source§

fn none() -> MaybeAbi<u64>

Source§

impl MaybeIntoWasmAbi for u128

Source§

type MaybeAbi = MaybeAbi<u128>

Source§

fn into_maybe_abi(self) -> MaybeAbi<u128>

Source§

fn none() -> MaybeAbi<u128>

Source§

impl MaybeIntoWasmAbi for usize

Source§

impl<T> MaybeIntoWasmAbi for *const T

Source§

impl<T> MaybeIntoWasmAbi for *mut T

Implementors§

Source§

impl<T: OptionIntoWasmAbi> MaybeIntoWasmAbi for T

A spare value in T’s own ABI is the common case, so OptionIntoWasmAbi supplies the Option<T> ABI for every such type; a type without one implements MaybeIntoWasmAbi itself with a wider MaybeAbi.