1#![doc = include_str!("../README.md")]
2#![deny(missing_debug_implementations)]
3#![deny(missing_docs)]
4
5mod service;
6
7use std::io;
8use std::num::ParseIntError;
9
10pub use service::Binding;
11pub use service::Listener;
12pub use service::Stream;
13
14#[derive(Debug)]
16#[non_exhaustive]
17pub enum Error {
18 BadAddress(io::Error),
20
21 BadDescriptor(ParseIntError),
23
24 DescriptorOutOfRange(i32),
26
27 DescriptorsMissing,
29
30 UnsupportedScheme,
32}
33
34impl From<ParseIntError> for Error {
35 fn from(error: ParseIntError) -> Self {
36 Error::BadDescriptor(error)
37 }
38}
39
40impl std::fmt::Display for Error {
41 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
42 write!(f, "{:?}", self)
43 }
44}
45
46impl std::error::Error for Error {}
47
48#[cfg(test)]
49mod tests {
50 use super::*;
51
52 #[test]
53 fn test_display() {
54 format!("{}", Error::UnsupportedScheme);
55 }
56}