pub struct OnClose(pub bool);
Expand description
Sent by Connection after CLS is sent to nsqd
§Examples
use actix::prelude::*;
use nsq_client::{Connection, Subscribe, OnClose};
struct Consumer(pub Addr<Connection>);
impl Actor for Consumer {
type Context = Context<Self>;
fn started(&mut self, ctx: &mut Self::Context) {
self.subscribe::<OnClose>(ctx, self.0.clone());
}
}
impl Handler<OnClose> for Consumer {
type Result = ();
fn handle(&mut self, msg: OnClose, ctx: &mut Self::Conetxt) {
if msg.0 == true {
println!("connection closed");
} else {
println!("connection closing failed");
}
}
}
Tuple Fields§
§0: bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OnClose
impl RefUnwindSafe for OnClose
impl Send for OnClose
impl Sync for OnClose
impl Unpin for OnClose
impl UnwindSafe for OnClose
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