Skip to main content

Nullable

Enum Nullable 

Source
pub enum Nullable<T> {
    Null,
    Value(T),
}
Expand description

A T or null at the JS boundary.

Nullable<T> is the Rust-side type for a JS value of type T | null, as Option<T> is for T | undefined, and Option<Nullable<T>> is the union T | null | undefined. All three are accepted in the same positions: as an argument or return value of exported and imported functions, as a public field of an exported struct, and as a closure argument or return value, including the &/&mut reference forms Option<T> supports.

TypeJS typeJS → RustRust → JS
Option<T>T | undefinedundefined and null → None; anything else goes to T’s conversionNone → undefined
Nullable<T>T | nullnull → Null; anything else, undefined included, goes to T’s conversionNull → null
Option<Nullable<T>>T | null | undefinedundefined → None, null → Some(Null), else Some(Value(..))None → undefined, Some(Null) → null

The Option layer of Option<Nullable<T>> treats only undefined as None, since null has to reach the Nullable layer. opt.and_then(Nullable::value) collapses the union to an Option<T>. No other nesting is supported: Nullable<Nullable<T>>, Nullable<Option<T>> and Option<Option<T>> do not cross the boundary.

Both may also name a slot of a js-sys Function<fn(..)> signature or a Promise<T> resolution. Where a js-sys container’s type-erased methods marshal the element itself, as Array::get and Map::get do, the element must be a handle: use the JS-side JsOption<T> and JsNullable<T> there, which stay JS values rather than converting.

Variants§

§

Null

JS null.

§

Value(T)

A value.

Implementations§

Source§

impl<T> Nullable<T>

Source

pub const fn is_null(&self) -> bool

Returns true if this is Null.

Source

pub const fn is_value(&self) -> bool

Returns true if this is a Value.

Source

pub const fn as_ref(&self) -> Nullable<&T>

Converts from &Nullable<T> to Nullable<&T>.

Source

pub fn as_mut(&mut self) -> Nullable<&mut T>

Converts from &mut Nullable<T> to Nullable<&mut T>.

Source

pub fn map<U, F>(self, f: F) -> Nullable<U>
where F: FnOnce(T) -> U,

Maps a Nullable<T> to Nullable<U> by applying a function to a contained value, leaving Null as it is.

Source

pub fn value(self) -> Option<T>

Returns the contained value as Some, or None for Null.

Source

pub fn into_option(self) -> Option<T>

Returns the contained value as Some, or None for Null.

Source

pub fn unwrap(self) -> T

Returns the contained value.

§Panics

Panics if this is Null.

Source

pub fn expect(self, msg: &str) -> T

Returns the contained value.

§Panics

Panics with msg if this is Null.

Source

pub fn unwrap_or(self, default: T) -> T

Returns the contained value or default.

Source

pub fn unwrap_or_else<F>(self, f: F) -> T
where F: FnOnce() -> T,

Returns the contained value or computes it from f.

Source

pub fn unwrap_or_default(self) -> T
where T: Default,

Returns the contained value or T::default().

Source

pub fn is_value_and(self, f: impl FnOnce(T) -> bool) -> bool

Returns true if this is a Value and f holds for it.

Source

pub fn is_null_or(self, f: impl FnOnce(T) -> bool) -> bool

Returns true if this is Null, or a Value for which f holds.

Source

pub fn ok_or<E>(self, err: E) -> Result<T, E>

Returns the contained value as Ok, or Err(err) for Null.

Source

pub fn ok_or_else<E, F>(self, err: F) -> Result<T, E>
where F: FnOnce() -> E,

Returns the contained value as Ok, or Err(err()) for Null.

Source

pub fn and_then<U, F>(self, f: F) -> Nullable<U>
where F: FnOnce(T) -> Nullable<U>,

Returns Null for Null, otherwise calls f on the contained value.

Source

pub fn filter<P>(self, predicate: P) -> Nullable<T>
where P: FnOnce(&T) -> bool,

Returns the contained value if predicate holds for it, otherwise Null.

Source

pub fn take(&mut self) -> Nullable<T>

Takes the value out, leaving Null in its place.

Source

pub fn replace(&mut self, value: T) -> Nullable<T>

Replaces the contents with Value(value), returning the old contents.

Source

pub fn iter(&self) -> IntoIter<&T> ⓘ

Returns an iterator over the contained value, if any.

Source

pub fn iter_mut(&mut self) -> IntoIter<&mut T> ⓘ

Returns a mutable iterator over the contained value, if any.

Source§

impl<T> Nullable<T>
where T: Deref,

Source

pub fn as_deref(&self) -> Nullable<&<T as Deref>::Target>

Converts from Nullable<T> (or &Nullable<T>) to Nullable<&T::Target>.

Source§

impl<T> Nullable<T>
where T: DerefMut,

Source

pub fn as_deref_mut(&mut self) -> Nullable<&mut <T as Deref>::Target>

Converts from Nullable<T> (or &mut Nullable<T>) to Nullable<&mut T::Target>.

Source§

impl<T> Nullable<&T>
where T: Copy,

Source

pub fn copied(self) -> Nullable<T>

Maps a Nullable<&T> to a Nullable<T> by copying the referent.

Source§

impl<T> Nullable<&T>
where T: Clone,

Source

pub fn cloned(self) -> Nullable<T>

Maps a Nullable<&T> to a Nullable<T> by cloning the referent.

Source§

impl<T> Nullable<&mut T>
where T: Copy,

Source

pub fn copied(self) -> Nullable<T>

Maps a Nullable<&mut T> to a Nullable<T> by copying the referent.

Source§

impl<T> Nullable<&mut T>
where T: Clone,

Source

pub fn cloned(self) -> Nullable<T>

Maps a Nullable<&mut T> to a Nullable<T> by cloning the referent.

Trait Implementations§

Source§

impl<T> Clone for Nullable<T>
where T: Clone,

Source§

fn clone(&self) -> Nullable<T>

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 for Nullable<T>
where T: Copy,

Source§

impl<T> Debug for Nullable<T>
where T: Debug,

Source§

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

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

impl<T> Default for Nullable<T>

Source§

fn default() -> Nullable<T>

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

impl<T> Eq for Nullable<T>
where T: Eq,

Source§

impl<T> ErasableGeneric for Nullable<T>
where T: ErasableGeneric,

Source§

type Repr = Nullable<<T as ErasableGeneric>::Repr>

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

impl<T> From<Nullable<T>> for JsNullable<T>
where T: JsGeneric,

Source§

fn from(nullable: Nullable<T>) -> JsNullable<T>

Converts to this type from the input type.
Source§

impl<T> From<Option<T>> for Nullable<T>

Source§

fn from(option: Option<T>) -> Nullable<T>

Converts to this type from the input type.
Source§

impl<T> From<T> for Nullable<T>

Source§

fn from(value: T) -> Nullable<T>

Converts to this type from the input type.
Source§

impl<T> FromWasmAbi for Nullable<T>

Source§

type Abi = <T as MaybeFromWasmAbi>::MaybeAbi

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

unsafe fn from_abi(js: <T as MaybeFromWasmAbi>::MaybeAbi) -> Nullable<T>

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

impl<T> Hash for Nullable<T>
where T: Hash,

Source§

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

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> IntoIterator for Nullable<T>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <Nullable<T> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T> IntoIterator for &'a Nullable<T>

Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<&'a T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <&'a Nullable<T> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T> IntoIterator for &'a mut Nullable<T>

Source§

type Item = &'a mut T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<&'a mut T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <&'a mut Nullable<T> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T> IntoWasmAbi for Nullable<T>

Source§

type Abi = <T as MaybeIntoWasmAbi>::MaybeAbi

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

fn into_abi(self) -> <T as MaybeIntoWasmAbi>::MaybeAbi

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

impl<'a, T> IntoWasmAbi for &'a Nullable<T>
where T: WasmDescribe, Nullable<&'a T>: IntoWasmAbi,

Source§

type Abi = <Nullable<&'a T> as IntoWasmAbi>::Abi

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

fn into_abi(self) -> <&'a Nullable<T> as IntoWasmAbi>::Abi

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

impl<T> OptionFromWasmAbi for Nullable<T>

T’s undefined test may cover its null sentinel too, as a slice’s does with the null pointer, so Null is ruled out first.

Source§

fn is_none(js: &<T as MaybeFromWasmAbi>::MaybeAbi) -> bool

Tests whether the argument is a “none” instance. If so it will be deserialized as None, and otherwise it will be passed to FromWasmAbi.
Source§

impl<T> OptionIntoWasmAbi for Nullable<T>

Option<Nullable<T>> is None for T’s undefined ABI value.

Source§

fn none() -> <T as MaybeIntoWasmAbi>::MaybeAbi

Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more
Source§

impl<'a, T> OptionIntoWasmAbi for &'a Nullable<T>
where T: WasmDescribe, Nullable<&'a T>: OptionIntoWasmAbi,

Source§

fn none() -> <&'a Nullable<T> as IntoWasmAbi>::Abi

Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more
Source§

impl<T> Ord for Nullable<T>
where T: Ord,

Source§

fn cmp(&self, other: &Nullable<T>) -> 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 for Nullable<T>
where T: PartialEq,

Source§

fn eq(&self, other: &Nullable<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 for Nullable<T>
where T: PartialOrd,

Source§

fn partial_cmp(&self, other: &Nullable<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> Promising for Nullable<T>
where T: Promising,

Source§

type Resolution = Nullable<<T as Promising>::Resolution>

The type that this value resolves to.
Source§

impl<T> StructuralPartialEq for Nullable<T>
where T: PartialEq,

Source§

impl<T> TryFromJsValue for Nullable<T>
where T: TryFromJsValue,

Source§

const NULLABLE: bool = true

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_ref(value: &JsValue) -> Option<Nullable<T>>

Performs the conversion.
Source§

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

Performs the conversion.
Source§

impl<'a, Target> UpcastFrom<&'a str> for Nullable<Target>
where Target: UpcastFrom<&'a str>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<AggregateError> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<AggregateError>,

Source§

impl<T, __UpcastWrapTarget> UpcastFrom<Array<T>> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Array<T>>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<ArrayBuffer> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<ArrayBuffer>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<ArrayBufferOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<ArrayBufferOptions>,

Source§

impl<T: JsTuple, Target: UpcastFrom<ArrayTuple<T>>> UpcastFrom<ArrayTuple<T>> for Nullable<Target>

Source§

impl<__UpcastWrapTarget> UpcastFrom<AsyncDisposableStack> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<AsyncDisposableStack>,

Source§

impl<T, __UpcastWrapTarget> UpcastFrom<AsyncGenerator<T>> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<AsyncGenerator<T>>,

Source§

impl<T, __UpcastWrapTarget> UpcastFrom<AsyncIterator<T>> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<AsyncIterator<T>>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Base64Options> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Base64Options>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<BigInt64Array> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<BigInt64Array>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<BigInt> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<BigInt>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<BigUint64Array> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<BigUint64Array>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Boolean> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Boolean>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Collator> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Collator>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<CollatorOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<CollatorOptions>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<CompileError> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<CompileError>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<CompileOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<CompileOptions>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<DataView> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<DataView>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Date> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Date>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<DateTimeFormat> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<DateTimeFormat>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<DateTimeFormatOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<DateTimeFormatOptions>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<DateTimeFormatPart> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<DateTimeFormatPart>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<DateTimeRangeFormatPart> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<DateTimeRangeFormatPart>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<DisplayNames> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<DisplayNames>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<DisplayNamesOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<DisplayNamesOptions>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<DisposableStack> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<DisposableStack>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Duration> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Duration>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<DurationFormat> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<DurationFormat>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<DurationFormatOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<DurationFormatOptions>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<DurationFormatPart> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<DurationFormatPart>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Error> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Error>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<ErrorOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<ErrorOptions>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<EvalError> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<EvalError>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Exception> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Exception>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<FinalizationRegistry> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<FinalizationRegistry>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Float16Array> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Float16Array>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Float32Array> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Float32Array>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Float64Array> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Float64Array>,

Source§

impl<T: JsFunction, Target: UpcastFrom<Function<T>>> UpcastFrom<Function<T>> for Nullable<Target>

Source§

impl<T, __UpcastWrapTarget> UpcastFrom<Generator<T>> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Generator<T>>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Global> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Global>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Instance> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Instance>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<InstantiatedSource> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<InstantiatedSource>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Int8Array> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Int8Array>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Int16Array> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Int16Array>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Int32Array> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Int32Array>,

Source§

impl<T, __UpcastWrapTarget> UpcastFrom<Iterator<T>> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Iterator<T>>,

Source§

impl<T, __UpcastWrapTarget> UpcastFrom<IteratorNext<T>> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<IteratorNext<T>>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<JsClosure> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<JsClosure>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<JsString> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<JsString>,

Source§

impl<Target> UpcastFrom<JsValue> for Nullable<Target>
where Target: UpcastFrom<JsValue>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<LinkError> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<LinkError>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<ListFormat> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<ListFormat>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<ListFormatOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<ListFormatOptions>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<ListFormatPart> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<ListFormatPart>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Locale> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Locale>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<LocaleMatcherOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<LocaleMatcherOptions>,

Source§

impl<K, V, __UpcastWrapTarget> UpcastFrom<Map<K, V>> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Map<K, V>>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Memory> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Memory>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Module> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Module>,

Source§

impl<T> UpcastFrom<Null> for Nullable<T>

Source§

impl<T, Target> UpcastFrom<Nullable<T>> for Nullable<Target>
where Target: UpcastFrom<T>,

Source§

impl<T, Target> UpcastFrom<Nullable<T>> for JsOption<Nullable<Target>>
where Target: UpcastFrom<T>,

Source§

impl<T, Target> UpcastFrom<Nullable<T>> for JsNullable<Nullable<Target>>
where Target: UpcastFrom<T>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Number> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Number>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<NumberFormat> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<NumberFormat>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<NumberFormatOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<NumberFormatOptions>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<NumberFormatPart> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<NumberFormatPart>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<NumberRangeFormatPart> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<NumberRangeFormatPart>,

Source§

impl<T, __UpcastWrapTarget> UpcastFrom<Object<T>> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Object<T>>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<PluralRules> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<PluralRules>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<PluralRulesOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<PluralRulesOptions>,

Source§

impl<T, E, __UpcastWrapTarget> UpcastFrom<Promise<T, E>> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Promise<T, E>>,

Source§

impl<T, E, __UpcastWrapTarget> UpcastFrom<PromiseState<T, E>> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<PromiseState<T, E>>,

Source§

impl<T, E, Target: UpcastFrom<PromiseWithResolvers<T, E>>> UpcastFrom<PromiseWithResolvers<T, E>> for Nullable<Target>

Source§

impl<T, __UpcastWrapTarget> UpcastFrom<PropertyDescriptor<T>> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<PropertyDescriptor<T>>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Proxy> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Proxy>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<RangeError> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<RangeError>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<ReferenceError> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<ReferenceError>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<RegExp> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<RegExp>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<RegExpMatchArray> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<RegExpMatchArray>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<RelativeTimeFormat> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<RelativeTimeFormat>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<RelativeTimeFormatOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<RelativeTimeFormatOptions>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<RelativeTimeFormatPart> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<RelativeTimeFormatPart>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<ResolvedCollatorOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<ResolvedCollatorOptions>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<ResolvedDateTimeFormatOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<ResolvedDateTimeFormatOptions>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<ResolvedDisplayNamesOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<ResolvedDisplayNamesOptions>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<ResolvedDurationFormatOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<ResolvedDurationFormatOptions>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<ResolvedListFormatOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<ResolvedListFormatOptions>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<ResolvedNumberFormatOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<ResolvedNumberFormatOptions>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<ResolvedPluralRulesOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<ResolvedPluralRulesOptions>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<ResolvedRelativeTimeFormatOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<ResolvedRelativeTimeFormatOptions>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<ResolvedSegmenterOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<ResolvedSegmenterOptions>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<RuntimeError> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<RuntimeError>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<SegmentData> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<SegmentData>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Segmenter> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Segmenter>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<SegmenterOptions> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<SegmenterOptions>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Segments> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Segments>,

Source§

impl<T, __UpcastWrapTarget> UpcastFrom<Set<T>> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Set<T>>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<SetFromResult> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<SetFromResult>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<SharedArrayBuffer> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<SharedArrayBuffer>,

Source§

impl<Target> UpcastFrom<String> for Nullable<Target>
where Target: UpcastFrom<String>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<SuppressedError> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<SuppressedError>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Suspending> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Suspending>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Symbol> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Symbol>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<SyntaxError> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<SyntaxError>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Table> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Table>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Tag> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Tag>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<TextInfo> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<TextInfo>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<TypeError> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<TypeError>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Uint8Array> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Uint8Array>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Uint8ClampedArray> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Uint8ClampedArray>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Uint16Array> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Uint16Array>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<Uint32Array> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<Uint32Array>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<UriError> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<UriError>,

Source§

impl<K, V, __UpcastWrapTarget> UpcastFrom<WeakMap<K, V>> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<WeakMap<K, V>>,

Source§

impl<T, __UpcastWrapTarget> UpcastFrom<WeakRef<T>> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<WeakRef<T>>,

Source§

impl<T, __UpcastWrapTarget> UpcastFrom<WeakSet<T>> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<WeakSet<T>>,

Source§

impl<__UpcastWrapTarget> UpcastFrom<WeekInfo> for Nullable<__UpcastWrapTarget>
where __UpcastWrapTarget: UpcastFrom<WeekInfo>,

Source§

impl<Target> UpcastFrom<bool> for Nullable<Target>
where Target: UpcastFrom<bool>,

Source§

impl<Target> UpcastFrom<char> for Nullable<Target>
where Target: UpcastFrom<char>,

Source§

impl<Target> UpcastFrom<f32> for Nullable<Target>
where Target: UpcastFrom<f32>,

Source§

impl<Target> UpcastFrom<f64> for Nullable<Target>
where Target: UpcastFrom<f64>,

Source§

impl<Target> UpcastFrom<i8> for Nullable<Target>
where Target: UpcastFrom<i8>,

Source§

impl<Target> UpcastFrom<i16> for Nullable<Target>
where Target: UpcastFrom<i16>,

Source§

impl<Target> UpcastFrom<i32> for Nullable<Target>
where Target: UpcastFrom<i32>,

Source§

impl<Target> UpcastFrom<i64> for Nullable<Target>
where Target: UpcastFrom<i64>,

Source§

impl<Target> UpcastFrom<i128> for Nullable<Target>
where Target: UpcastFrom<i128>,

Source§

impl<Target> UpcastFrom<isize> for Nullable<Target>
where Target: UpcastFrom<isize>,

Source§

impl<Target> UpcastFrom<u8> for Nullable<Target>
where Target: UpcastFrom<u8>,

Source§

impl<Target> UpcastFrom<u16> for Nullable<Target>
where Target: UpcastFrom<u16>,

Source§

impl<Target> UpcastFrom<u32> for Nullable<Target>
where Target: UpcastFrom<u32>,

Source§

impl<Target> UpcastFrom<u64> for Nullable<Target>
where Target: UpcastFrom<u64>,

Source§

impl<Target> UpcastFrom<u128> for Nullable<Target>
where Target: UpcastFrom<u128>,

Source§

impl<Target> UpcastFrom<usize> for Nullable<Target>
where Target: UpcastFrom<usize>,

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<T> UnwindSafe for Nullable<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<T> MaybeFromWasmAbi for T

Source§

type MaybeAbi = <T as FromWasmAbi>::Abi

The ABI of Option<Self>.
Source§

unsafe fn from_maybe_abi(js: <T as FromWasmAbi>::Abi) -> T

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

unsafe fn try_from_maybe_abi( js: <T as FromWasmAbi>::Abi, ) -> Result<T, &'static str>

Source§

fn is_none(js: &<T as FromWasmAbi>::Abi) -> bool

Tests the ABI value for None.
Source§

impl<T> MaybeIntoWasmAbi for T

Source§

type MaybeAbi = <T as IntoWasmAbi>::Abi

The ABI of Option<Self>.
Source§

fn into_maybe_abi(self) -> <T as IntoWasmAbi>::Abi

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

fn none() -> <T as IntoWasmAbi>::Abi

Returns the ABI value for None, which JS reads as undefined. Read more
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, 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::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::Repr>,

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