libhoney/
sender.rs

1use crossbeam_channel::Receiver;
2
3use crate::errors::Result;
4use crate::response::Response;
5use crate::Event;
6
7/// `Sender` is responsible for handling events after Send() is called.  Implementations
8/// of `send()` must be safe for concurrent calls.
9pub trait Sender {
10    /// `send` queues up an event to be sent
11    fn send(&mut self, ev: Event);
12
13    /// `start` initializes any background processes necessary to send events
14    fn start(&mut self);
15
16    /// `stop` flushes any pending queues and blocks until everything in flight has been
17    /// sent
18    fn stop(&mut self) -> Result<()>;
19
20    /// `responses` returns a channel that will contain a single Response for each Event
21    /// added. Note that they may not be in the same order as they came in
22    fn responses(&self) -> Receiver<Response>;
23}