Skip to main content

Signature

Trait functions

deref

Wrapper for Deref::deref. Prefer using Deref::deref directly. This function exists for backwards compatibility.

Signature

Examples

Preferred way:
This function method does the same thing:

deref_or

Returns the contained value if not null, or returns the provided default value.

Signature

Examples

deref_or_else

Returns the contained value if not null, or computes it from a closure.

Signature

Examples

new

Creates a new non-null Nullable with the given value.

Signature

Examples

is_null

Returns true if the value is null.

Signature

Examples

as_snapshot

Creates a new Nullable containing a snapshot of the value. This is useful when working with non-copyable types inside a Nullable. This allows you to keep using the original value while also having access to a snapshot of it, preventing the original value from being moved.

Signature

Examples