pub struct PayloadInsertError<T> { /* private fields */ }Expand description
A failed SystemState::insert_payload operation that
retains ownership of the unchanged incoming payload.
A set operation can fail before moving payload into a state because the
requested field is undeclared or because its assembly-retained type contract
names a different concrete Rust type. The latter remains true even when the
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 moved into
SystemState::insert_payload. 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()