secel/errors.rs
1//! Errors implementation.
2
3use std::fmt;
4
5/// Common result type.
6pub type Result<T, E = SecelError> = std::result::Result<T, E>;
7
8/// Common error definition.
9#[derive(Debug, PartialEq, Eq)]
10pub struct SecelError(String);
11
12impl fmt::Display for SecelError {
13 /// Implementation of [Display](std::fmt::Display) trait for [SecelError].
14 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> fmt::Result {
15 write!(f, "{}", self.0)
16 }
17}
18
19impl SecelError {
20 /// Creates a new [SecelError] with specified message text.
21 pub fn new(message: &str) -> Self {
22 Self(message.to_string())
23 }
24}