change: more advanced searching and filtering

This commit is contained in:
ClementTsang
2020-05-01 23:53:29 -04:00
parent bb45763b39
commit 6e81fbeebf
14 changed files with 675 additions and 282 deletions
+12 -1
View File
@@ -1,4 +1,4 @@
use std::result;
use std::{borrow::Cow, result};
/// A type alias for handling errors related to Bottom.
pub type Result<T> = result::Result<T, BottomError>;
@@ -22,6 +22,8 @@ pub enum BottomError {
ConfigError(String),
/// An error to represent errors with converting between data types.
ConversionError(String),
/// An error to represent errors with querying.
QueryError(Cow<'static, str>),
}
impl std::fmt::Display for BottomError {
@@ -47,6 +49,9 @@ impl std::fmt::Display for BottomError {
BottomError::ConversionError(ref message) => {
write!(f, "unable to convert: {}", message)
}
BottomError::QueryError(ref _message) => {
write!(f, "invalid query - this should not be shown!")
}
}
}
}
@@ -98,3 +103,9 @@ impl From<std::str::Utf8Error> for BottomError {
BottomError::ConversionError(err.to_string())
}
}
impl From<regex::Error> for BottomError {
fn from(err: regex::Error) -> Self {
BottomError::QueryError(err.to_string().into())
}
}
+1
View File
@@ -1,3 +1,4 @@
#[cfg(debug_assertions)]
pub fn init_logger() -> Result<(), fern::InitError> {
fern::Dispatch::new()
.format(|out, message, record| {