pub struct Msg {
pub timestamp: i64,
pub attemps: u16,
pub id: String,
pub body: Vec<u8>,
}
Expand description
Message sent by nsqd
§Examples
struct Consumer(Addr<Connection>);
impl Actor for Consumer {
type Context = Context<Self>;
fn handle(&mut self, ctx: &mut Self::Context) {
self.subscribe::<Msg>(ctx, self.0.clone());
}
}
fn Handler<Msg> for Consumer {
type Result = ();
fn handle(&mut self, msg: Msg, _: &mut Self::Context) {
println!("timestamp: {}", msg.timestamp);
println!("attemps: {}", msg.attemps);
println!("id: {}", msg.id);
println!("data: {}", msg.body);
println!("msg debug: {:?}", msg);
}
}
Fields§
§timestamp: i64
Timestamp of the message
attemps: u16
Number of attemps reader tried to process the message
id: String
Id of the message
body: Vec<u8>
Data sent by nsqd
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Msg
impl RefUnwindSafe for Msg
impl Send for Msg
impl Sync for Msg
impl Unpin for Msg
impl UnwindSafe for Msg
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