pub enum Successor<T, U = T> {
    Continue(U),
    Terminate,
    Interrupt(T),
}
Expand description

The successor state or outcome of an episode step.

The purpose of the second generic parameter U is to control the ownership of the following state or observation when the episode continues. By default the successor is owned but it can also be borrowed U = &T or omitted U = (). This is useful because users might want to extract the next observation without copying.

Variants

Continue(U)

The episode continues with the given state.

Terminate

The episode ends by entering a terminal state.

A terminal state is one from which all possible trajectories would have 0 reward.

Interrupt(T)

The episode ends despite entering the given non-terminal state.

Had the episode continued, non-zero future rewards might have been possible. For example, the episode may have been interrupted due to a step limit.

Implementations

Unwrap into the contained Continue value if possible.

Unwrap into the contained Interrupt value if possible.

Whether this successor marks the end of an episode

Drop any stored Continue state, converting into PartialSuccessor.

Apply a function to just the successor Continue variant.

Partition into a PartialSuccessor and the Continue state, if any.

Apply a transformation to the inner state when present.

Interrupt the successor if it is Continue and the condition evaluates true.

Get the inner state of Continue and Interrupt variants.

Convert &Successor<T, U> to Successor<&T>.

Convert Successor<&T, &U> to Successor<T, U> by cloning its contents

Convert into an owned successor by cloning any borrowed successor observation.

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

Deserialize this value from the given Serde deserializer. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. 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

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

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.