pub struct Reply { /* private fields */ }Expand description
What a Handler returns for a task that succeeded: the fields of its output, which the
worker adds to the result after the envelope’s own.
use legit_streams::Reply;
let reply = Reply::new().field("result", "{\"ok\":true}").model_name("example-model");
assert_eq!(reply.fields(), [("result".to_owned(), "{\"ok\":true}".to_owned())]);Implementations§
Source§impl Reply
impl Reply
Sourcepub fn new() -> Self
pub fn new() -> Self
A reply with no fields.
assert!(legit_streams::Reply::new().fields().is_empty());Sourcepub fn field(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn field(self, name: impl Into<String>, value: impl Into<String>) -> Self
Add an output field, such as result or embedding.
let reply = legit_streams::Reply::new().field("embedding_format", "base64_fp32");
assert_eq!(reply.fields().len(), 1);Sourcepub fn model_name(self, model_name: impl Into<String>) -> Self
pub fn model_name(self, model_name: impl Into<String>) -> Self
Name the model that ran in the result’s model_name, rather than echoing the task’s: on a
success something ran, and its name may be fuller than the one the task asked for.
let reply = legit_streams::Reply::new().model_name("example-model");Trait Implementations§
impl Eq for Reply
impl StructuralPartialEq for Reply
Auto Trait Implementations§
impl Forget for Reply
impl Freeze for Reply
impl Move for Reply
impl RefUnwindSafe for Reply
impl Send for Replywhere
RawVecInner: Send,
impl Sync for Replywhere
RawVecInner: Sync,
impl Unpin for Reply
impl UnsafeUnpin for Replywhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<(String, String)>: UnsafeUnpin,
impl UnwindSafe for Replywhere
RawVecInner: 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