Struct StreamWriter
pub struct StreamWriter { /* private fields */ }Expand description
A writer of one of the run’s streams (Ctx::stream). Opened in
workflow code, it writes the run’s stream, which close() or the run’s
end completes; opened inside a step’s function, the step’s stream,
which the step’s final result completes.
Implementations§
§impl StreamWriter
impl StreamWriter
pub fn name(&self) -> &str
pub fn append<T: Serialize + ?Sized>(&self, value: &T) -> Result<()>
pub fn append<T: Serialize + ?Sized>(&self, value: &T) -> Result<()>
Appends value as JSON. Never waits for the disk. Inside a step it
records the running attempt; in workflow code a replay appends
nothing.
pub fn append_bytes(&self, bytes: &[u8]) -> Result<()>
pub fn append_bytes(&self, bytes: &[u8]) -> Result<()>
Appends raw bytes; readers get them back as bytes.
pub fn recorded_len(&self) -> u64
pub fn recorded_len(&self) -> u64
Inside a step: how many chunks the step’s earlier attempts recorded (after a crash, the durable ones). 0 on a first attempt and in workflow code.
pub fn recorded<T: DeserializeOwned>(&self) -> Result<Vec<T>>
pub fn recorded<T: DeserializeOwned>(&self) -> Result<Vec<T>>
The chunks the step’s earlier attempts recorded, decoded from JSON: a step that runs again continues after them (for a model, by passing them back as the start of its answer), so readers see no chunk twice.
pub fn recorded_raw(&self) -> Result<Vec<Payload>>
pub fn recorded_raw(&self) -> Result<Vec<Payload>>
Self::recorded as payloads: JSON, or bytes after a zero byte.
Trait Implementations§
§impl Clone for StreamWriter
impl Clone for StreamWriter
§fn clone(&self) -> StreamWriter
fn clone(&self) -> StreamWriter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more