Expand description
The JSON envelope types. A view serializes a result as is. The envelope
wraps a success or a failure for a reader that wants a status and a schema
version: Envelope::Ok holds a result, and Envelope::Err holds an
ErrorBody.
View::emit_err writes an Envelope::Err for a failure with no model.
The types serialize with the json feature and describe themselves with
schema.
use ctl_core::model::{Envelope, ErrorBody, SCHEMA_VERSION};
let failed = Envelope::<()>::err(ErrorBody::new("toy", "no such row"));
assert!(matches!(
failed,
Envelope::Err {
schema_version: SCHEMA_VERSION,
..
}
));Structs§
- Error
Body - The payload of a failure envelope: which binary failed, and why.
Enums§
- Envelope
- A JSON envelope:
statusisokwithdata, orerrwitherror, and both carryschema_version.
Constants§
- SCHEMA_
VERSION - The envelope shape version, written to every envelope as
schema_version. ctl-core raises it when the envelope shape changes.