Struct async_nats::Client 
source · [−]pub struct Client { /* private fields */ }Expand description
Client is a Clonable handle to NATS connection.
Client should not be created directly. Instead, one of two methods can be used:
crate::connect and crate::ConnectOptions::connect
Implementations
sourceimpl Client
 
impl Client
pub async fn publish(
    &self,
    subject: String,
    payload: Bytes
) -> Result<(), PublishError>
pub async fn publish_with_headers(
    &self,
    subject: String,
    headers: HeaderMap,
    payload: Bytes
) -> Result<(), Error>
pub async fn publish_with_reply(
    &self,
    subject: String,
    reply: String,
    payload: Bytes
) -> Result<(), Error>
pub async fn publish_with_reply_and_headers(
    &self,
    subject: String,
    reply: String,
    headers: HeaderMap,
    payload: Bytes
) -> Result<(), PublishError>
pub async fn request(
    &self,
    subject: String,
    payload: Bytes
) -> Result<Message, Error>
pub async fn request_with_headers(
    &self,
    subject: String,
    headers: HeaderMap,
    payload: Bytes
) -> Result<Message, Error>
sourcepub fn new_inbox(&self) -> String
 
pub fn new_inbox(&self) -> String
Create a new globally unique inbox which can be used for replies.
Examples
let reply = nc.new_inbox();
let rsub = nc.subscribe(reply).await?;pub async fn subscribe(&self, subject: String) -> Result<Subscriber, Error>
pub async fn queue_subscribe(
    &self,
    subject: String,
    queue_group: String
) -> Result<Subscriber, Error>
pub async fn flush(&self) -> Result<(), Error>
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
    T: ?Sized, 
 
impl<T> BorrowMut<T> for T where
    T: ?Sized, 
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more