pub trait ApiErrorBody {
type Body;
// Required methods
fn body(&self) -> Option<&Self::Body>;
fn into_body(self) -> Option<Self::Body>
where Self: Sized;
}Expand description
Implemented by the generated error shapes that carry one documented body type, so code
generic over operations can reach that body without naming each E.
Three shapes implement it: a multi-status enum whose bodied statuses carry the same body type
(one schema, or schemas that generate the same Rust type; its body is None for a
documented bodyless status, or a null payload), the
single-body newtype (Body is the bare schema type, so a nullable body answers None for
null exactly as the enum does), and the uninhabited Infallible shape, so Error::api_body
exists on those operations. An enum whose statuses carry different body types has no
implementation: there is no single body to hand back, and the compile error is the signal.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".