Struct nitox::NatsClient
source · pub struct NatsClient { /* private fields */ }
Expand description
The NATS Client. What you’ll be using mostly. All the async handling is made internally except for
the system messages that are forwarded on the Stream
that the client implements
Implementations
sourceimpl NatsClient
impl NatsClient
sourcepub fn from_options(
opts: NatsClientOptions
) -> impl Future<Item = Self, Error = NatsError> + Send + Sync
pub fn from_options(
opts: NatsClientOptions
) -> impl Future<Item = Self, Error = NatsError> + Send + Sync
Creates a client and initiates a connection to the server
Returns impl Future<Item = Self, Error = NatsError>
sourcepub fn connect(
self
) -> impl Future<Item = Self, Error = NatsError> + Send + Sync
pub fn connect(
self
) -> impl Future<Item = Self, Error = NatsError> + Send + Sync
Sends the CONNECT command to the server to setup connection
Returns impl Future<Item = Self, Error = NatsError>
sourcepub fn send(self, op: Op) -> impl Future<Item = Self, Error = NatsError>
👎Deprecated since 0.1.4: Using this method prevents the library to track what you are sending to the server and causes memory leaks in case of subscriptions/unsubs, it’ll be fully removed in v0.2.0
pub fn send(self, op: Op) -> impl Future<Item = Self, Error = NatsError>
Send a raw command to the server
Returns impl Future<Item = Self, Error = NatsError>
sourcepub fn publish(
&self,
cmd: PubCommand
) -> impl Future<Item = (), Error = NatsError> + Send + Sync
pub fn publish(
&self,
cmd: PubCommand
) -> impl Future<Item = (), Error = NatsError> + Send + Sync
Send a PUB command to the server
Returns impl Future<Item = (), Error = NatsError>
sourcepub fn unsubscribe(
&self,
cmd: UnsubCommand
) -> impl Future<Item = (), Error = NatsError> + Send + Sync
pub fn unsubscribe(
&self,
cmd: UnsubCommand
) -> impl Future<Item = (), Error = NatsError> + Send + Sync
Send a UNSUB command to the server and de-register stream in the multiplexer
Returns impl Future<Item = (), Error = NatsError>
sourcepub fn subscribe(
&self,
cmd: SubCommand
) -> impl Future<Item = impl Stream<Item = Message, Error = NatsError> + Send + Sync, Error = NatsError> + Send + Sync
pub fn subscribe(
&self,
cmd: SubCommand
) -> impl Future<Item = impl Stream<Item = Message, Error = NatsError> + Send + Sync, Error = NatsError> + Send + Sync
Send a SUB command and register subscription stream in the multiplexer and return that Stream
in a future
Returns impl Future<Item = impl Stream<Item = Message, Error = NatsError>>
sourcepub fn request(
&self,
subject: String,
payload: Bytes
) -> impl Future<Item = Message, Error = NatsError> + Send + Sync
pub fn request(
&self,
subject: String,
payload: Bytes
) -> impl Future<Item = Message, Error = NatsError> + Send + Sync
Performs a request to the server following the Request/Reply pattern. Returns a future containing the MSG that will be replied at some point by a third party
Returns impl Future<Item = Message, Error = NatsError>
Trait Implementations
sourceimpl Debug for NatsClient
impl Debug for NatsClient
sourceimpl Stream for NatsClient
impl Stream for NatsClient
sourcefn poll(&mut self) -> Result<Async<Option<Self::Item>>, Self::Error>
fn poll(&mut self) -> Result<Async<Option<Self::Item>>, Self::Error>
None
if
the stream is finished. Read moresourcefn wait(self) -> Wait<Self>where
Self: Sized,
fn wait(self) -> Wait<Self>where
Self: Sized,
sourcefn into_future(self) -> StreamFuture<Self>where
Self: Sized,
fn into_future(self) -> StreamFuture<Self>where
Self: Sized,
Future
. Read moresourcefn filter<F>(self, f: F) -> Filter<Self, F>where
F: FnMut(&Self::Item) -> bool,
Self: Sized,
fn filter<F>(self, f: F) -> Filter<Self, F>where
F: FnMut(&Self::Item) -> bool,
Self: Sized,
sourcefn filter_map<F, B>(self, f: F) -> FilterMap<Self, F>where
F: FnMut(Self::Item) -> Option<B>,
Self: Sized,
fn filter_map<F, B>(self, f: F) -> FilterMap<Self, F>where
F: FnMut(Self::Item) -> Option<B>,
Self: Sized,
sourcefn then<F, U>(self, f: F) -> Then<Self, F, U>where
F: FnMut(Result<Self::Item, Self::Error>) -> U,
U: IntoFuture,
Self: Sized,
fn then<F, U>(self, f: F) -> Then<Self, F, U>where
F: FnMut(Result<Self::Item, Self::Error>) -> U,
U: IntoFuture,
Self: Sized,
f
. Read moresourcefn and_then<F, U>(self, f: F) -> AndThen<Self, F, U>where
F: FnMut(Self::Item) -> U,
U: IntoFuture<Error = Self::Error>,
Self: Sized,
fn and_then<F, U>(self, f: F) -> AndThen<Self, F, U>where
F: FnMut(Self::Item) -> U,
U: IntoFuture<Error = Self::Error>,
Self: Sized,
f
. Read moresourcefn or_else<F, U>(self, f: F) -> OrElse<Self, F, U>where
F: FnMut(Self::Error) -> U,
U: IntoFuture<Item = Self::Item>,
Self: Sized,
fn or_else<F, U>(self, f: F) -> OrElse<Self, F, U>where
F: FnMut(Self::Error) -> U,
U: IntoFuture<Item = Self::Item>,
Self: Sized,
f
. Read moresourcefn collect(self) -> Collect<Self>where
Self: Sized,
fn collect(self) -> Collect<Self>where
Self: Sized,
sourcefn fold<F, T, Fut>(self, init: T, f: F) -> Fold<Self, F, Fut, T>where
F: FnMut(T, Self::Item) -> Fut,
Fut: IntoFuture<Item = T>,
Self::Error: From<<Fut as IntoFuture>::Error>,
Self: Sized,
fn fold<F, T, Fut>(self, init: T, f: F) -> Fold<Self, F, Fut, T>where
F: FnMut(T, Self::Item) -> Fut,
Fut: IntoFuture<Item = T>,
Self::Error: From<<Fut as IntoFuture>::Error>,
Self: Sized,
sourcefn skip_while<P, R>(self, pred: P) -> SkipWhile<Self, P, R>where
P: FnMut(&Self::Item) -> R,
R: IntoFuture<Item = bool, Error = Self::Error>,
Self: Sized,
fn skip_while<P, R>(self, pred: P) -> SkipWhile<Self, P, R>where
P: FnMut(&Self::Item) -> R,
R: IntoFuture<Item = bool, Error = Self::Error>,
Self: Sized,
true
. Read moresourcefn take_while<P, R>(self, pred: P) -> TakeWhile<Self, P, R>where
P: FnMut(&Self::Item) -> R,
R: IntoFuture<Item = bool, Error = Self::Error>,
Self: Sized,
fn take_while<P, R>(self, pred: P) -> TakeWhile<Self, P, R>where
P: FnMut(&Self::Item) -> R,
R: IntoFuture<Item = bool, Error = Self::Error>,
Self: Sized,
true
. Read moresourcefn for_each<F, U>(self, f: F) -> ForEach<Self, F, U>where
F: FnMut(Self::Item) -> U,
U: IntoFuture<Item = (), Error = Self::Error>,
Self: Sized,
fn for_each<F, U>(self, f: F) -> ForEach<Self, F, U>where
F: FnMut(Self::Item) -> U,
U: IntoFuture<Item = (), Error = Self::Error>,
Self: Sized,
sourcefn from_err<E>(self) -> FromErr<Self, E>where
E: From<Self::Error>,
Self: Sized,
fn from_err<E>(self) -> FromErr<Self, E>where
E: From<Self::Error>,
Self: Sized,
From
for
this stream’s Error
, returning a new stream. Read moresourcefn take(self, amt: u64) -> Take<Self>where
Self: Sized,
fn take(self, amt: u64) -> Take<Self>where
Self: Sized,
amt
items of the underlying stream. Read moresourcefn skip(self, amt: u64) -> Skip<Self>where
Self: Sized,
fn skip(self, amt: u64) -> Skip<Self>where
Self: Sized,
amt
items of the underlying stream. Read moresourcefn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where
Self: Sized,
poll
will never again be called once it has
finished. Read moresourcefn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
sourcefn merge<S>(self, other: S) -> Merge<Self, S>where
S: Stream<Error = Self::Error>,
Self: Sized,
fn merge<S>(self, other: S) -> Merge<Self, S>where
S: Stream<Error = Self::Error>,
Self: Sized,
select
nowsourcefn zip<S>(self, other: S) -> Zip<Self, S>where
S: Stream<Error = Self::Error>,
Self: Sized,
fn zip<S>(self, other: S) -> Zip<Self, S>where
S: Stream<Error = Self::Error>,
Self: Sized,
sourcefn chain<S>(self, other: S) -> Chain<Self, S>where
S: Stream<Item = Self::Item, Error = Self::Error>,
Self: Sized,
fn chain<S>(self, other: S) -> Chain<Self, S>where
S: Stream<Item = Self::Item, Error = Self::Error>,
Self: Sized,
sourcefn peekable(self) -> Peekable<Self>where
Self: Sized,
fn peekable(self) -> Peekable<Self>where
Self: Sized,
peek
method. Read more