use std::sync::Arc;
pub type Result<T> = std::result::Result<T, Error>;
pub type ArcResult<T> = std::result::Result<T, Arc<Error>>;
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[allow(missing_docs)]
#[error(transparent)]
Io(#[from] std::io::Error),
#[allow(missing_docs)]
#[error(transparent)]
Transport(#[from] tonic::transport::Error),
#[allow(missing_docs)]
#[error(transparent)]
Rusqlite(#[from] tokio_rusqlite::Error),
#[allow(missing_docs)]
#[error(transparent)]
Toml(#[from] toml::de::Error),
#[allow(missing_docs)]
#[error(transparent)]
Flexbuffers(#[from] flexbuffers::DeserializationError),
#[allow(missing_docs)]
#[error(transparent)]
Rpc(#[from] tonic::Status),
#[allow(missing_docs)]
#[error(transparent)]
Join(#[from] tokio::task::JoinError),
#[error("generator panicked")]
Panic,
#[error(transparent)]
Backoff(#[from] Box<backoff::Error<Error>>),
#[error("entry is currently being loaded")]
EntryLoading,
#[error("entry is currently unavailable")]
EntryUnavailable,
#[error("entry cannot be assigned")]
EntryUnassignable,
}
pub enum TryInnerError<'a, E> {
CacheError(Arc<Error>),
GeneratorError(&'a E),
}
impl<'a, E> From<Arc<Error>> for TryInnerError<'a, E> {
fn from(value: Arc<Error>) -> Self {
Self::CacheError(value)
}
}
impl<'a, E> From<&'a E> for TryInnerError<'a, E> {
fn from(value: &'a E) -> Self {
Self::GeneratorError(value)
}
}