[−][src]Struct nats::asynk::Connection
A NATS client connection.
Implementations
impl Connection
[src]
pub async fn publish<'_, '_>(
&'_ self,
subject: &'_ str,
msg: impl AsRef<[u8]>
) -> Result<()>
[src]
&'_ self,
subject: &'_ str,
msg: impl AsRef<[u8]>
) -> Result<()>
Publishes a message.
pub async fn publish_request<'_, '_, '_>(
&'_ self,
subject: &'_ str,
reply: &'_ str,
msg: impl AsRef<[u8]>
) -> Result<()>
[src]
&'_ self,
subject: &'_ str,
reply: &'_ str,
msg: impl AsRef<[u8]>
) -> Result<()>
Publishes a message with a reply subject.
pub fn new_inbox(&self) -> String
[src]
Creates a new unique subject for receiving replies.
pub async fn request<'_, '_>(
&'_ self,
subject: &'_ str,
msg: impl AsRef<[u8]>
) -> Result<Message>
[src]
&'_ self,
subject: &'_ str,
msg: impl AsRef<[u8]>
) -> Result<Message>
Publishes a message and waits for the response.
pub async fn request_multi<'_, '_>(
&'_ self,
subject: &'_ str,
msg: impl AsRef<[u8]>
) -> Result<Subscription>
[src]
&'_ self,
subject: &'_ str,
msg: impl AsRef<[u8]>
) -> Result<Subscription>
Publishes a message and returns a subscription for awaiting the response.
pub async fn subscribe<'_, '_>(
&'_ self,
subject: &'_ str
) -> Result<Subscription>
[src]
&'_ self,
subject: &'_ str
) -> Result<Subscription>
Creates a subscription.
pub async fn queue_subscribe<'_, '_, '_>(
&'_ self,
subject: &'_ str,
queue: &'_ str
) -> Result<Subscription>
[src]
&'_ self,
subject: &'_ str,
queue: &'_ str
) -> Result<Subscription>
Creates a queue subscription.
pub async fn flush<'_>(&'_ self) -> Result<()>
[src]
Flushes by performing a round trip to the server.
pub async fn flush_timeout<'_>(&'_ self, timeout: Duration) -> Result<()>
[src]
Flushes by performing a round trip to the server or times out after a duration of time.
pub async fn rtt<'_>(&'_ self) -> Result<Duration>
[src]
Calculates the round trip time between this client and the server.
pub fn client_ip(&self) -> Result<IpAddr>
[src]
Returns the client IP as known by the most recently connected server.
Supported as of server version 2.1.6.
pub fn client_id(&self) -> u64
[src]
Returns the client ID as known by the most recently connected server.
pub async fn drain<'_>(&'_ self) -> Result<()>
[src]
Unsubscribes all subscriptions and flushes the connection.
Remaining messages can still be received by existing Subscription
s.
pub async fn close<'_>(&'_ self) -> Result<()>
[src]
Closes the connection.
pub async fn publish_with_reply_or_headers<'_, '_, '_, '_>(
&'_ self,
subject: &'_ str,
reply: Option<&'_ str>,
headers: Option<&'_ Headers>,
msg: impl AsRef<[u8]>
) -> Result<()>
[src]
&'_ self,
subject: &'_ str,
reply: Option<&'_ str>,
headers: Option<&'_ Headers>,
msg: impl AsRef<[u8]>
) -> Result<()>
Publish a message which may have a reply subject or headers set.
Trait Implementations
impl Clone for Connection
[src]
fn clone(&self) -> Connection
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Connection
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl !UnwindSafe for Connection
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut Tⓘ
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,