Skip to main content

PayloadInsertError

Struct PayloadInsertError 

Source
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>

Source

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.

Source

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.

Source

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>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats bounded diagnostic context without requiring or inspecting T: Debug.

Source§

impl<T> Display for PayloadInsertError<T>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Delegates the user-facing message to the state-validation reason.

Source§

impl<T> Error for PayloadInsertError<T>

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Exposes the contained StateError for standard error-chain traversal.

1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.