From 2ee8ae2e34adea389d46b98895acddc6d377bb9a Mon Sep 17 00:00:00 2001 From: projectmoon Date: Tue, 20 Oct 2020 20:57:31 +0000 Subject: [PATCH] Document the From trait on the DataError type. --- src/db.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/db.rs b/src/db.rs index 46c463b..4bd4fc1 100644 --- a/src/db.rs +++ b/src/db.rs @@ -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. This converter +/// extracts the inner data error from transaction aborted errors, and +/// forwards anything else onward as-is, but wrapped in DataError. impl From> for DataError { fn from(error: TransactionError) -> Self { match error {