pub enum StreamItem {
Data {
metadata: Option<StreamMetadata>,
content_type: Option<String>,
content: Value,
},
Progress {
metadata: Option<StreamMetadata>,
content_type: Option<String>,
content: Value,
},
Error {
metadata: Option<StreamMetadata>,
recoverable: bool,
message: Option<String>,
code: Option<String>,
error: RemoteError,
fields: Map<String, Value>,
},
Done {
metadata: Option<StreamMetadata>,
},
}Expand description
One item of a Plexus response stream, as delivered by a Transport.
Variants§
Data
A payload item. content is the activation’s own event, still as
JSON; [crate::decode] is what turns it into the method’s event type.
Fields
metadata: Option<StreamMetadata>Progress
A progress report: the method’s progress value P as JSON
({"message", "percentage"} for the default crate::Note). Never
terminates the stream.
Fields
metadata: Option<StreamMetadata>Error
An in-band call failure reported by the service — as opposed to a
crate::TransportError, which is the connection failing. Typed:
its RemoteError’s Display is the human line. Terminates the
stream.
Fields
metadata: Option<StreamMetadata>message: Option<String>spec/05’s human line (never parsed for meaning). Absent from a REST unary body.
error: RemoteErrorRETURNS-6: why the call failed, typed — what a typed client decodes.
Done
Normal end of stream.
Fields
metadata: Option<StreamMetadata>Implementations§
Source§impl StreamItem
impl StreamItem
Sourcepub fn data(content: Value) -> Self
pub fn data(content: Value) -> Self
Convenience constructor for a data item with no server metadata — the shape the REST + SSE bridge produces.
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
true for the two variants after which no further item may arrive.
Sourcepub fn metadata(&self) -> Option<&StreamMetadata>
pub fn metadata(&self) -> Option<&StreamMetadata>
The provenance metadata, when the transport carried it.