#[derive(Clone, Debug, Eq, PartialEq, thiserror::Error)]
#[error("Server Fault {}: {}", .code, .string)]
pub struct Fault {
code: i32,
string: String,
}
impl Fault {
#[must_use]
pub const fn new(code: i32, string: String) -> Fault {
Fault { code, string }
}
#[must_use]
pub const fn code(&self) -> i32 {
self.code
}
#[must_use]
pub fn string(&self) -> &str {
self.string.as_str()
}
pub(crate) fn into_inner(self) -> (i32, String) {
(self.code, self.string)
}
}