pub enum Envelope<T> {
#[non_exhaustive] Ok {
schema_version: u32,
data: T,
},
#[non_exhaustive] Err {
schema_version: u32,
error: ErrorBody,
},
}Expand description
A JSON envelope: status is ok with data, or err with error,
and both carry schema_version.
Build one with Envelope::ok or Envelope::err. Each variant can
gain a field in a minor release, so a pattern outside ctl-core ends
with ...
Variants§
#[non_exhaustive]Ok
A success. Serializes with "status": "ok".
Fields
This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§
schema_version: u32The envelope shape version,
SCHEMA_VERSION.
§
data: TThe command’s result.
#[non_exhaustive]Err
A failure. Serializes with "status": "err".
Fields
This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§
schema_version: u32The envelope shape version,
SCHEMA_VERSION.
Implementations§
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Envelope<T>where
T: Deserialize<'de>,
Available on crate feature json only.
impl<'de, T> Deserialize<'de> for Envelope<T>where
T: Deserialize<'de>,
Available on crate feature
json only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<T: Eq> Eq for Envelope<T>
Source§impl<T> JsonSchema for Envelope<T>where
T: JsonSchema,
Available on crate feature schema only.
impl<T> JsonSchema for Envelope<T>where
T: JsonSchema,
Available on crate feature
schema only.Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreimpl<T: PartialEq> StructuralPartialEq for Envelope<T>
Auto Trait Implementations§
impl<T> Forget for Envelope<T>
impl<T> Freeze for Envelope<T>where
T: Freeze,
impl<T> Move for Envelope<T>
impl<T> RefUnwindSafe for Envelope<T>where
T: RefUnwindSafe,
impl<T> Send for Envelope<T>where
T: Send,
impl<T> Sync for Envelope<T>where
T: Sync,
impl<T> Unpin for Envelope<T>where
T: Unpin,
impl<T> UnsafeUnpin for Envelope<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Envelope<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more