pub struct OptionSpace<S> {
    pub inner: S,
}
Expand description

A space whose elements are either None or Some(inner_elem).

The feature vectors are

  • [1, 0, ..., 0] for None
  • [0, inner_feature_vector(x)] for Some(x).

Fields

inner: S

Implementations

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

Formats the value using the given formatter. Read more

Generate a random value of T, using rng as the source of randomness.

Create an iterator that generates random values of T, using rng as the source of randomness. Read more

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more

Features are [0.0, features(x)..] for Some(x) and [1.0, 0.0, ..., 0.0] for None.

Length of the encoded feature vectors.

Encode the feature vector of an element into a mutable slice. Read more

Encode the feature vector of an element into an array.

Encode the feature vectors of multiple elements into rows of a two-dimensional array. Read more

Encode the feature vectors of multiple elements as rows of a two-dimensional array.

The number of elements in the space.

Get the (unique) index of an element.

Try to convert an index to an element. Read more

Try to convert an index to an element. Read more

Feeds this value into the given Hasher. Read more

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

Log an element of the space

An arbitrary deterministic element from the space.

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

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

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this value into the given Serde serializer. Read more

Check whether a particular value is contained in the space.

Compare using the subset relationship. This is a partial order.

Check if this is a strict subset of other.

Check if this is a subset (strict or equal) of other.

Check if this is a strict superset of other.

Check if this is a superset (strict or equal) of other.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Convert into an Any trait reference.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The resulting type after obtaining ownership.

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

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

Converts the given value to a String. 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.