1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#![forbid(missing_docs)]
use std::error::Error;
use std::fmt;
pub mod browser;
mod ffi;
pub mod register;
pub mod txt;
#[macro_use]
extern crate log;
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum DNSServiceError {
InvalidString,
InternalInvalidString,
ServiceError(i32),
}
impl fmt::Display for DNSServiceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
DNSServiceError::InvalidString => {
write!(f, "Invalid string argument, must be C-string compatible")
}
DNSServiceError::InternalInvalidString => write!(f, "Invalid string received from FFI"),
DNSServiceError::ServiceError(e) => write!(f, "Service error: {}", e),
}
}
}
impl Error for DNSServiceError {
}
pub type Result<T> = std::result::Result<T, DNSServiceError>;