odbc_safe/data_source/hdbc_wrapper.rs
1use super::*;
2
3/// Implemented by `Connected` and `Unconnected`.
4///
5/// There are two implementations of this trait. These two implementations only decide wether or
6/// not a `disconnect` should be executed on drop. This trait allows to handle them both in generic
7/// code and makes them syntactically very similar to a direct use of `HDbc`.
8pub trait HDbcWrapper<'env>: DerefMut<Target = HDbc<'env>> {
9 /// Type to a handle, which also must implement this trait.
10 type Handle: HDbcWrapper<'env>;
11 /// Release ownership of the internal Connection Handle
12 fn into_hdbc(self) -> HDbc<'env>;
13 /// Construction from a Connection Handle
14 fn from_hdbc(handle: HDbc<'env>) -> Self::Handle;
15}