/* This file is part of jellything (https://codeberg.org/metamuffin/jellything) which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2026 metamuffin */ use crate::{Database, Transaction}; use anyhow::Result; pub trait DatabaseReturnExt: Database { fn transaction_ret( &self, mut t: impl FnMut(&mut dyn Transaction) -> Result, ) -> Result { let mut ret = None; self.transaction(&mut |x| { ret = Some(t(x)?); Ok(()) })?; Ok(ret.unwrap()) } } impl DatabaseReturnExt for D {}