Document the From trait on the DataError type.

This commit is contained in:
projectmoon 2020-10-20 20:57:31 +00:00 committed by ProjectMoon
parent 114c879c6f
commit 2ee8ae2e34
1 changed files with 6 additions and 0 deletions

View File

@ -44,6 +44,12 @@ pub enum DataError {
UnabortableTransactionError(#[from] UnabortableTransactionError),
}
/// This From implementation is necessary to deal with the recursive
/// error type in the error enum. We defined a transaction error, but
/// the only place we use it is when converting from
/// sled::transaction::TransactionError<DataError>. This converter
/// extracts the inner data error from transaction aborted errors, and
/// forwards anything else onward as-is, but wrapped in DataError.
impl From<TransactionError<DataError>> for DataError {
fn from(error: TransactionError<DataError>) -> Self {
match error {