odbc_safe/data_source/
unconnected.rs

1use super::*;
2use std::ops::Deref;
3
4/// An `HDbc` with the additional invariant of being 'allocated', but not 'connected'.
5#[derive(Debug)]
6pub struct Unconnected<'env>(HDbc<'env>);
7
8impl<'env> Deref for Unconnected<'env> {
9    type Target = HDbc<'env>;
10    fn deref(&self) -> &Self::Target {
11        &self.0
12    }
13}
14
15impl<'env> DerefMut for Unconnected<'env> {
16    fn deref_mut(&mut self) -> &mut Self::Target {
17        &mut self.0
18    }
19}
20
21impl<'env> HDbcWrapper<'env> for Unconnected<'env> {
22    type Handle = Unconnected<'env>;
23
24    fn into_hdbc(self) -> HDbc<'env> {
25        self.0
26    }
27
28    fn from_hdbc(hdbc: HDbc<'env>) -> Self::Handle {
29        Unconnected(hdbc)
30    }
31}