pub enum Output {
File(PathBuf),
Tcp(String),
Channel(Sender<Snapshot>),
}Expand description
Output destination for snapshots.
Configure where the instrumentor should emit snapshots.
Variants§
File(PathBuf)
Write snapshots to a JSON file.
The file is overwritten with each snapshot.
Tcp(String)
Send snapshots to a TCP server.
Each snapshot is sent as a newline-delimited JSON message.
Channel(Sender<Snapshot>)
Send snapshots through a channel.
Use Output::channel() to create this variant and get the receiver.
Implementations§
Source§impl Output
impl Output
Sourcepub fn channel(buffer: usize) -> (Self, Receiver<Snapshot>)
pub fn channel(buffer: usize) -> (Self, Receiver<Snapshot>)
Create a channel output and return both the output and receiver.
This is useful for integrating with your own snapshot handling.
§Example
use buswatch_sdk::Output;
let (output, mut rx) = Output::channel(16);
// Later, receive snapshots
// while let Some(snapshot) = rx.recv().await {
// println!("Got snapshot with {} modules", snapshot.len());
// }Trait Implementations§
Auto Trait Implementations§
impl Freeze for Output
impl RefUnwindSafe for Output
impl Send for Output
impl Sync for Output
impl Unpin for Output
impl UnwindSafe for Output
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