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§
Required Methods§
Sourcefn into_maybe_abi(self) -> Self::MaybeAbi
fn into_maybe_abi(self) -> Self::MaybeAbi
Converts a value into the Option<Self> ABI.
Sourcefn none() -> Self::MaybeAbi
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
impl MaybeIntoWasmAbi for f32
Source§impl MaybeIntoWasmAbi for f64
impl MaybeIntoWasmAbi for f64
Source§impl MaybeIntoWasmAbi for i32
impl MaybeIntoWasmAbi for i32
Source§impl MaybeIntoWasmAbi for i64
impl MaybeIntoWasmAbi for i64
Source§impl MaybeIntoWasmAbi for i128
impl MaybeIntoWasmAbi for i128
Source§impl MaybeIntoWasmAbi for isize
impl MaybeIntoWasmAbi for isize
Source§impl MaybeIntoWasmAbi for u32
impl MaybeIntoWasmAbi for u32
Source§impl MaybeIntoWasmAbi for u64
impl MaybeIntoWasmAbi for u64
Source§impl MaybeIntoWasmAbi for u128
impl MaybeIntoWasmAbi for u128
Source§impl MaybeIntoWasmAbi for usize
impl MaybeIntoWasmAbi for usize
Source§impl<T> MaybeIntoWasmAbi for *const T
impl<T> MaybeIntoWasmAbi for *const T
Source§impl<T> MaybeIntoWasmAbi for *mut T
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.
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.