netloc_core/reporter.rs
1//! [`Reporter`] and associated types.
2
3use async_trait::async_trait;
4
5/// An abstract way to report the [`Data`].
6///
7/// Implement this to send the IP address updates to a new detination.
8#[async_trait]
9pub trait Reporter {
10 /// The error that this reporter can produce.
11 type Error;
12
13 /// Report the passed [`Data`].
14 async fn report(&self, data: &Data) -> Result<(), Self::Error>;
15}
16
17/// The data associated with an IP address update.
18#[derive(Debug)]
19pub struct Data {
20 /// The IP address.
21 pub ip: String,
22}