mirror of
https://github.com/Drop-OSS/dropbreak.git
synced 2026-07-18 09:57:53 -04:00
Document other_errors
This commit is contained in:
@@ -17,6 +17,8 @@ use crate::error;
|
||||
/// It should always read and save in full the data that it is passed. This
|
||||
/// means that a write to the backend followed by a read __must__ return the
|
||||
/// same dataset.
|
||||
///
|
||||
/// **Important**: You can only return custom errors if the `other_errors` feature is enabled
|
||||
pub trait Backend {
|
||||
/// Read the all data from the backend.
|
||||
fn get_data(&mut self) -> error::BackendResult<Vec<u8>>;
|
||||
|
||||
@@ -68,6 +68,8 @@ pub use self::bincode::Bincode;
|
||||
///
|
||||
/// fn main() {}
|
||||
/// ```
|
||||
///
|
||||
/// **Important**: You can only return custom errors if the `other_errors` feature is enabled
|
||||
pub trait DeSerializer<T: Serialize + DeserializeOwned>:
|
||||
std::default::Default + Send + Sync + Clone
|
||||
{
|
||||
|
||||
+18
-1
@@ -19,8 +19,16 @@ pub enum DeSerError {
|
||||
/// An error occured with Bincode
|
||||
#[error("An error with Bincode occured")]
|
||||
Bincode(#[from] std::boxed::Box<bincode::ErrorKind>),
|
||||
/// An internal error to Rustbreak occured
|
||||
#[error("An internal error to rustbreak occured, please report it to the maintainers")]
|
||||
Internal(String),
|
||||
#[cfg(feature = "other_errors")]
|
||||
/// An error occured with Bincode
|
||||
/// A dynamic error occured
|
||||
///
|
||||
/// Most likely the custom `DeSer` implementation has thrown an error, consult its documentation
|
||||
/// for more information
|
||||
///
|
||||
/// **Important**: This can only be used if the `other_errors` feature is enabled
|
||||
#[error(transparent)]
|
||||
Other(#[from] anyhow::Error),
|
||||
}
|
||||
@@ -38,6 +46,15 @@ pub enum BackendError {
|
||||
/// An internal error to Rustbreak occured
|
||||
#[error("An internal error to rustbreak occured, please report it to the maintainers")]
|
||||
Internal(String),
|
||||
#[cfg(feature = "other_errors")]
|
||||
/// A dynamic error occured
|
||||
///
|
||||
/// Most likely the custom `Backend` implementation has thrown an error, consult its documentation
|
||||
/// for more information
|
||||
///
|
||||
/// **Important**: This can only be used if the `other_errors` feature is enabled
|
||||
#[error(transparent)]
|
||||
Other(#[from] anyhow::Error),
|
||||
}
|
||||
|
||||
/// The different kinds of errors that can be returned
|
||||
|
||||
Reference in New Issue
Block a user