Skip to main content

OptionalBound

Trait OptionalBound 

Source
pub trait OptionalBound {
    type UnderlyingBound: Boundedness;

    // Required method
    fn bound_kind() -> OptionalBoundKind;
}
Expand description

A marker trait indicating the boundedness of an Optional.

In addition to Bounded (immutable) and Unbounded (arbitrarily mutable, including becoming null again), this also includes additional variants that constrain how the optional’s presence (whether it is null) and value evolve over time.

The currently defined variants form a hierarchy of increasing strength; variants other than Bounded erase to Unbounded:

  • Unbounded: the optional may become null and non-null arbitrarily, with an arbitrary value whenever it is non-null.
  • InitNone: the optional starts null, but once it becomes non-null it stays non-null forever; the non-null value may still change arbitrarily.

Required Associated Types§

Source

type UnderlyingBound: Boundedness

The Boundedness that this Optional would be erased to.

Required Methods§

Source

fn bound_kind() -> OptionalBoundKind

Returns the OptionalBoundKind corresponding to this type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§