Signature
Trait functions
deref
Wrapper forDeref::deref
. Prefer using Deref::deref
directly.
This function exists for backwards compatibility.
Signature
Examples
Preferred way: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-nullNullable
with the given value.
Signature
Examples
is_null
Returnstrue
if the value is null.
Signature
Examples
as_snapshot
Creates a newNullable
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.