Trait odbc_api_helper::TryConvert
source · [−]pub trait TryConvert<T>: Sized {
type Error;
fn try_convert(self) -> Result<T, Self::Error>;
}Required Associated Types
Required Methods
fn try_convert(self) -> Result<T, Self::Error>
Implementations on Foreign Types
sourceimpl TryConvert<Type> for DmDateType
impl TryConvert<Type> for DmDateType
sourceimpl TryConvert<PgTableItem> for DmTableItem
impl TryConvert<PgTableItem> for DmTableItem
type Error = Error
fn try_convert(self) -> Result<PgTableItem, Self::Error>
sourceimpl TryConvert<BufferDescription> for (&OdbcColumn, &Options)
impl TryConvert<BufferDescription> for (&OdbcColumn, &Options)
type Error = String
fn try_convert(self) -> Result<BufferDescription, Self::Error>
sourceimpl TryConvert<Date> for Date
impl TryConvert<Date> for Date
Convert odbc_api::sys::Date to time::Date
Example
use odbc_api_helper::TryConvert;
let odbc_data = OdbcDate{year: 2020,month: 1,day: 1};
assert_eq!(date!(2020 - 01 - 01), odbc_data.try_convert().unwrap());
let odbc_data = OdbcDate{year: 2022,month: 12,day: 31};
assert_eq!(date!(2022 - 12 - 31), odbc_data.try_convert().unwrap());
sourceimpl TryConvert<Time> for Time
impl TryConvert<Time> for Time
Convert odbc_api::sys::Time to time::Time
Example
use odbc_api_helper::TryConvert;
let odbc_time = OdbcTime { hour: 3,minute: 1,second: 1 };
assert_eq!(time!(03 : 01: 01), odbc_time.try_convert().unwrap());
let odbc_time = OdbcTime { hour: 19,minute: 31,second: 59 };
assert_eq!(time!(19 : 31 : 59), odbc_time.try_convert().unwrap());