pub struct SingularPtrField<T> { /* private fields */ }
Expand description

Like Option<Box<T>>, but keeps the actual element on clear.

Implementations

Construct SingularPtrField from given object.

Construct an empty SingularPtrField.

Construct SingularPtrField from optional.

True iff this object contains data.

True iff this object contains no data.

Convert into Option<T>.

View data as reference option.

View data as mutable reference option.

Get data as reference. Panics if empty.

Get data as mutable reference. Panics if empty.

Take the data. Panics if empty

Take the data or return supplied default element if empty.

Take the data or return supplied default element if empty.

Apply given function to contained data to construct another SingularPtrField. Returns empty SingularPtrField if this object is empty.

View data as iterator.

View data as mutable iterator.

Take data as option, leaving this object empty.

Clear this object, but do not call destructor of underlying data.

Get contained data, consume self. Return default value for type if this is empty.

Initialize this object with default value. This operation can be more efficient then construction of clear element, because it may reuse previously contained object.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Deserialize this value from the given Serde deserializer. Read more

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.