#[non_exhaustive]pub enum EnvironmentError {
InvalidAction(String),
RenderFailed(String),
IoError(Error),
Config(ConfigError),
StepAfterEpisodeEnd {
status: EpisodeStatus,
},
}Expand description
Error type for environment operations.
EnvironmentError captures failures that can occur during environment
initialization, reset, or stepping. It provides detailed error messages
and supports error chaining via the standard std::error::Error trait.
The enum is #[non_exhaustive]: downstream match expressions must carry a
wildcard arm, so a future variant is not a breaking change.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidAction(String)
An invalid or out-of-bounds action was provided.
RenderFailed(String)
Rendering or display failed.
IoError(Error)
An I/O operation failed (wraps std::io::Error).
Config(ConfigError)
A configuration-domain invariant failed during a lifecycle operation.
A reset() may re-run construction-time work (e.g. rebuilding a
procedural world), so a config-domain invariant — a ConfigError —
can surface at reset, not only at construction. This variant is kept
generic (not tied to any one environment) so any lifecycle method
that re-validates config-domain state can propagate the failure with
?, avoiding a stringly-typed re-wrap.
StepAfterEpisodeEnd
step() was called after the episode already ended.
The action itself was legal; the call sequence was not. An episode that
has emitted a snapshot with Snapshot::is_done == true is over — the
only valid next lifecycle call is Environment::reset. Stepping again
would silently resurrect a finished episode (re-entering the MDP from a
terminal state, emitting rewards on a Running snapshot), so it is an
error rather than a no-op.
The variant carries the EpisodeStatus that ended the episode, so the
caller can distinguish an intrinsic MDP termination
(EpisodeStatus::Terminated) from a wrapper-imposed truncation
(EpisodeStatus::Truncated).
Fields
status: EpisodeStatusThe status that ended the episode (Terminated or Truncated).
Trait Implementations§
Source§impl Debug for EnvironmentError
impl Debug for EnvironmentError
Source§impl Display for EnvironmentError
impl Display for EnvironmentError
Source§impl Error for EnvironmentError
impl Error for EnvironmentError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<ConfigError> for EnvironmentError
impl From<ConfigError> for EnvironmentError
Source§fn from(source: ConfigError) -> Self
fn from(source: ConfigError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for EnvironmentError
impl !UnwindSafe for EnvironmentError
impl Freeze for EnvironmentError
impl Send for EnvironmentError
impl Sync for EnvironmentError
impl Unpin for EnvironmentError
impl UnsafeUnpin for EnvironmentError
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more