Struct async_nats::Connection [−][src]
pub struct Connection { /* fields omitted */ }
Expand description
A NATS client connection.
Implementations
impl Connection
[src]
impl Connection
[src]pub async fn publish(&self, subject: &str, msg: impl AsRef<[u8]>) -> Result<()>
[src]
pub async fn publish(&self, subject: &str, msg: impl AsRef<[u8]>) -> Result<()>
[src]Publishes a message.
pub async fn publish_request(
&self,
subject: &str,
reply: &str,
msg: impl AsRef<[u8]>
) -> Result<()>
[src]
pub async fn publish_request(
&self,
subject: &str,
reply: &str,
msg: impl AsRef<[u8]>
) -> Result<()>
[src]Publishes a message with a reply subject.
pub async fn request(
&self,
subject: &str,
msg: impl AsRef<[u8]>
) -> Result<Message>
[src]
pub async fn request(
&self,
subject: &str,
msg: impl AsRef<[u8]>
) -> Result<Message>
[src]Publishes a message and waits for the response.
pub async fn request_timeout(
&self,
subject: &str,
msg: impl AsRef<[u8]>,
timeout: Duration
) -> Result<Message>
[src]
pub async fn request_timeout(
&self,
subject: &str,
msg: impl AsRef<[u8]>,
timeout: Duration
) -> Result<Message>
[src]Publishes a message and waits for the response or until the timeout duration is reached
pub async fn request_multi(
&self,
subject: &str,
msg: impl AsRef<[u8]>
) -> Result<Subscription>
[src]
pub async fn request_multi(
&self,
subject: &str,
msg: impl AsRef<[u8]>
) -> Result<Subscription>
[src]Publishes a message and returns a subscription for awaiting the response.
pub async fn subscribe(&self, subject: &str) -> Result<Subscription>
[src]
pub async fn subscribe(&self, subject: &str) -> Result<Subscription>
[src]Creates a subscription.
pub async fn queue_subscribe(
&self,
subject: &str,
queue: &str
) -> Result<Subscription>
[src]
pub async fn queue_subscribe(
&self,
subject: &str,
queue: &str
) -> Result<Subscription>
[src]Creates a queue subscription.
pub async fn flush_timeout(&self, timeout: Duration) -> Result<()>
[src]
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]
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]
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]
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]
pub async fn drain(&self) -> Result<()>
[src]Unsubscribes all subscriptions and flushes the connection.
Remaining messages can still be received by existing Subscription
s.
Trait Implementations
impl Clone for Connection
[src]
impl Clone for Connection
[src]fn clone(&self) -> Connection
[src]
fn clone(&self) -> Connection
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
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> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,