instance_chart/
lib.rs

1#![doc= include_str!("../README.md")]
2
3mod chart;
4pub mod discovery;
5mod util;
6use std::io;
7
8pub use chart::{Chart, ChartBuilder, Notify};
9
10/// Identifier for a single instance of `Chart`. Must be unique.
11pub type Id = u64;
12
13/// Errors that can occure while building a Chart. Except for [`Bind`](Error::Bind) these rarely
14/// occur.
15#[derive(thiserror::Error, Debug)]
16pub enum Error {
17    /// Could not set up bare socket
18    #[error("Could not set up bare socket")]
19    Construct(io::Error),
20    /// Failed to set Reuse flag on the socket
21    #[error("Failed to set Reuse flag on the socket")]
22    SetReuse(io::Error),
23    /// Failed to set Broadcast flag on the socket
24    #[error("Failed to set Broadcast flag on the socket")]
25    SetBroadcast(io::Error),
26    /// Failed to set Multicast flag on the socket
27    #[error("Failed to set Multicast flag on the socket")]
28    SetMulticast(io::Error),
29    /// Failed to set TTL flag on the socket
30    #[error("Failed to set TTL flag on the socket")]
31    SetTTL(io::Error),
32    /// Failed to set NonBlocking flag on the socket
33    #[error("Failed to set NonBlocking flag on the socket")]
34    SetNonBlocking(io::Error),
35    /// Error binding to socket, you might want to try another discovery port and/or enable [`local_discovery`](ChartBuilder::local_discovery).
36    #[error("Error binding to socket, you might want to try another discovery port and/or enable local_discovery.")]
37    Bind { error: io::Error, port: u16 },
38    /// Failed joining multicast network
39    #[error("Failed joining multicast network")]
40    JoinMulticast(io::Error),
41    /// Failed to transform blocking to async socket
42    #[error("Failed to transform blocking to async socket")]
43    ToTokio(io::Error),
44}