pub enum StreamItem {
Data {
metadata: Option<StreamMetadata>,
content_type: Option<String>,
content: Value,
},
Progress {
metadata: Option<StreamMetadata>,
message: String,
percentage: Option<f32>,
},
Error {
metadata: Option<StreamMetadata>,
message: String,
code: Option<String>,
recoverable: bool,
},
Request {
request_id: String,
request_data: Value,
timeout_ms: u64,
},
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. Carries no payload; never terminates the stream.
Error
An in-band error raised by the hub or the activation — as opposed
to a crate::TransportError, which is the connection failing.
Terminates the stream.
Fields
metadata: Option<StreamMetadata>Request
A server-to-client request (bidirectional activations). The typed
client has no answer channel, so [crate::decode] skips these; a
consumer that needs them reads the raw StreamItem stream.
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.