pub struct NatsWorker { /* private fields */ }Expand description
Consumes one model subject in the workers queue group.
Clones share one subscription. Replies require the incoming message’s reply subject; malformed JSON and missing reply subjects return errors.
Implementations§
Source§impl NatsWorker
impl NatsWorker
Sourcepub async fn from_env_or_default() -> Result<Self>
pub async fn from_env_or_default() -> Result<Self>
Connects and subscribes to the prefix plus OPENAI_API_DEFAULT_MODEL.
Requires the model variable. URL/prefix defaults match
NatsProducer::from_env_or_default; missing configuration, connection,
and subscription errors are returned. No subscription flush is performed.
Trait Implementations§
Source§impl Clone for NatsWorker
impl Clone for NatsWorker
Source§fn clone(&self) -> NatsWorker
fn clone(&self) -> NatsWorker
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NatsWorker
impl Debug for NatsWorker
Source§impl QueueWorker for NatsWorker
impl QueueWorker for NatsWorker
Source§async fn receive_task(&self) -> Result<Option<WrappedTask<Self::Message>>>
async fn receive_task(&self) -> Result<Option<WrappedTask<Self::Message>>>
Receives a task, or
None when none is available or the stream ends. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for NatsWorker
impl !UnwindSafe for NatsWorker
impl Freeze for NatsWorker
impl Send for NatsWorker
impl Sync for NatsWorker
impl Unpin for NatsWorker
impl UnsafeUnpin for NatsWorker
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