pub struct PayloadInsertError<T> { /* private fields */ }Expand description
A failed payload initialization or insertion that retains ownership of the unchanged incoming payload.
SystemState::initialize_payload
rejects undeclared or already initialized fields.
SystemState::insert_payload
rejects undeclared fields and retained type mismatches, including when a
field is temporarily empty after take or clear. Returning only
StateError in those cases would drop the caller’s payload while
unwinding the failed call. PayloadInsertError instead keeps the rejection
reason and original T together, following the ownership-preserving pattern
of channel send errors.
The payload remains private so diagnostics cannot accidentally expose or
traverse large scientific data. Borrow it through PayloadInsertError::payload or
recover ownership of both components through PayloadInsertError::into_parts.
Neither operation invokes Clone.
§Formatting
Display delegates to the contained StateError. The
bounded Debug representation includes only that error and
the compile-time Rust type name of T; it never requires T: Debug or
formats the payload value.
Implementations§
Source§impl<T> PayloadInsertError<T>
impl<T> PayloadInsertError<T>
Sourcepub const fn error(&self) -> &StateError
pub const fn error(&self) -> &StateError
Returns the state-validation error that rejected the payload.
Borrowing the reason leaves the incoming payload owned by this error, allowing callers to inspect the failure before deciding how to recover or dispose of the scientific data.
Sourcepub const fn payload(&self) -> &T
pub const fn payload(&self) -> &T
Returns the unchanged rejected payload by shared reference.
The returned reference points to the same concrete T passed to the
rejected initialization or insertion. No payload clone, serialization,
downcast, or backing-buffer copy occurs.
Sourcepub fn into_parts(self) -> (StateError, T)
pub fn into_parts(self) -> (StateError, T)
Consumes the rejection and returns its reason and original payload.
The tuple is ordered as (StateError, T), matching the borrowed
PayloadInsertError::error then PayloadInsertError::payload inspection order. The
payload moves directly out of the error and retains its original owned
allocations.
Trait Implementations§
Source§impl<T> Debug for PayloadInsertError<T>
impl<T> Debug for PayloadInsertError<T>
Source§impl<T> Display for PayloadInsertError<T>
impl<T> Display for PayloadInsertError<T>
Source§impl<T> Error for PayloadInsertError<T>
impl<T> Error for PayloadInsertError<T>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Exposes the contained StateError for standard error-chain traversal.
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl<T> !RefUnwindSafe for PayloadInsertError<T>
impl<T> !UnwindSafe for PayloadInsertError<T>
impl<T> Freeze for PayloadInsertError<T>where
T: Freeze,
impl<T> Send for PayloadInsertError<T>where
T: Send,
impl<T> Sync for PayloadInsertError<T>where
T: Sync,
impl<T> Unpin for PayloadInsertError<T>where
T: Unpin,
impl<T> UnsafeUnpin for PayloadInsertError<T>where
T: UnsafeUnpin,
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> 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