pub struct Step<O, A, F = Reward, U = O> {
pub observation: O,
pub action: A,
pub feedback: F,
pub next: Successor<O, U>,
}Expand description
Description of an environment step.
There are a few different forms that this structure can take in terms of describing the
next observation when next is Successor::Continue.
These are determined by the value of the fourth generic parameter U:
Step<O, A, F>-U = O- The continuing successor observation is owned.TransientStep<O, A, F>-U = &O- The continuing successor observation is borrowed.PartialStep<O, A, F>-U = ()- The continuing successor observation is omitted.
If next is Successor::Interrupt then the observation is owned in all cases.
Fields§
§observation: OThe initial observation.
action: AThe action taken from the initial state given the initial observation.
feedback: FThe resulting feedback.
next: Successor<O, U>The next observation or outcome; how the episode progresses.
Implementations§
Source§impl<O, A, F, U> Step<O, A, F, U>
impl<O, A, F, U> Step<O, A, F, U>
pub const fn new( observation: O, action: A, feedback: F, next: Successor<O, U>, ) -> Self
Sourcepub const fn episode_done(&self) -> bool
pub const fn episode_done(&self) -> bool
Whether this step is the last of an episode.
pub fn into_partial(self) -> PartialStep<O, A, F>
Source§impl<O: Clone, A, F> Step<O, A, F, &O>
impl<O: Clone, A, F> Step<O, A, F, &O>
Sourcepub fn into_owned(self) -> Step<O, A, F>
pub fn into_owned(self) -> Step<O, A, F>
Convert a transient step into an owned step by cloning any borrowed successor observation.
Source§impl<O, A, F> Step<O, A, F, ()>
impl<O, A, F> Step<O, A, F, ()>
Sourcepub fn into_transient_with(self, next: &Self) -> TransientStep<'_, O, A, F>
pub fn into_transient_with(self, next: &Self) -> TransientStep<'_, O, A, F>
Convert a partial step into a transient step using the given reference to the next step.
Sourcepub fn try_into_transient<'a>(self) -> Option<TransientStep<'a, O, A, F>>
pub fn try_into_transient<'a>(self) -> Option<TransientStep<'a, O, A, F>>
Try to convert into a transient step with no successor.
Succeeds so long as self.next is not Successor::Continue.
Trait Implementations§
Source§impl<'a, O, A, F> Extend<&'a Step<O, A, F, ()>> for OnlineStepsSummary<F>where
O: 'a,
A: 'a,
F: Feedback + 'a,
impl<'a, O, A, F> Extend<&'a Step<O, A, F, ()>> for OnlineStepsSummary<F>where
O: 'a,
A: 'a,
F: Feedback + 'a,
Source§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = &'a PartialStep<O, A, F>>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = &'a PartialStep<O, A, F>>,
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl<O, A, F: Feedback> Extend<Step<O, A, F, ()>> for OnlineStepsSummary<F>
impl<O, A, F: Feedback> Extend<Step<O, A, F, ()>> for OnlineStepsSummary<F>
Source§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = PartialStep<O, A, F>>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = PartialStep<O, A, F>>,
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl<'a, O, A, F> FromIterator<&'a Step<O, A, F, ()>> for OnlineStepsSummary<F>where
O: 'a,
A: 'a,
F: Feedback + 'a,
impl<'a, O, A, F> FromIterator<&'a Step<O, A, F, ()>> for OnlineStepsSummary<F>where
O: 'a,
A: 'a,
F: Feedback + 'a,
Source§fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = &'a PartialStep<O, A, F>>,
fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = &'a PartialStep<O, A, F>>,
Source§impl<'a, O, A, F> FromIterator<&'a Step<O, A, F, ()>> for StepsSummary<F>where
O: 'a,
A: 'a,
F: Feedback + 'a,
impl<'a, O, A, F> FromIterator<&'a Step<O, A, F, ()>> for StepsSummary<F>where
O: 'a,
A: 'a,
F: Feedback + 'a,
Source§fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = &'a PartialStep<O, A, F>>,
fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = &'a PartialStep<O, A, F>>,
Source§impl<O, A, F: Feedback> FromIterator<Step<O, A, F, ()>> for OnlineStepsSummary<F>
impl<O, A, F: Feedback> FromIterator<Step<O, A, F, ()>> for OnlineStepsSummary<F>
Source§fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = PartialStep<O, A, F>>,
fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = PartialStep<O, A, F>>,
Source§impl<O, A, F: Feedback> FromIterator<Step<O, A, F, ()>> for StepsSummary<F>
impl<O, A, F: Feedback> FromIterator<Step<O, A, F, ()>> for StepsSummary<F>
Source§fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = PartialStep<O, A, F>>,
fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = PartialStep<O, A, F>>,
Source§impl<O, A, F> FromIterator<Step<O, A, F, ()>> for VecBuffer<O, A, F>
impl<O, A, F> FromIterator<Step<O, A, F, ()>> for VecBuffer<O, A, F>
Source§fn from_iter<I>(steps: I) -> Selfwhere
I: IntoIterator<Item = PartialStep<O, A, F>>,
fn from_iter<I>(steps: I) -> Selfwhere
I: IntoIterator<Item = PartialStep<O, A, F>>,
impl<O: Copy, A: Copy, F: Copy, U: Copy> Copy for Step<O, A, F, U>
impl<O, A, F, U> StructuralPartialEq for Step<O, A, F, U>
Auto Trait Implementations§
impl<O, A, F, U> Freeze for Step<O, A, F, U>
impl<O, A, F, U> RefUnwindSafe for Step<O, A, F, U>
impl<O, A, F, U> Send for Step<O, A, F, U>
impl<O, A, F, U> Sync for Step<O, A, F, U>
impl<O, A, F, U> Unpin for Step<O, A, F, U>
impl<O, A, F, U> UnwindSafe for Step<O, A, F, U>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more