pub trait TryConvert<T>: Sized {
type Error;
// Required method
fn try_convert(self) -> Result<T, Self::Error>;
}
Required Associated Types§
Required Methods§
fn try_convert(self) -> Result<T, Self::Error>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl TryConvert<DmDateType> for &PgType
impl TryConvert<DmDateType> for &PgType
type Error = Error
fn try_convert(self) -> Result<DmDateType, Self::Error>
Source§impl TryConvert<PgColumnItem> for (&OdbcColumnItem, &PgColumn)
impl TryConvert<PgColumnItem> for (&OdbcColumnItem, &PgColumn)
type Error = String
fn try_convert(self) -> Result<PgColumnItem, Self::Error>
Source§impl TryConvert<PgQueryResult> for (QueryResult, &Vec<PgTableItem>, &Options)
impl TryConvert<PgQueryResult> for (QueryResult, &Vec<PgTableItem>, &Options)
type Error = String
fn try_convert(self) -> Result<PgQueryResult, Self::Error>
Source§impl TryConvert<Vec<PgColumn>> for (&Vec<OdbcColumn>, &Vec<PgTableItem>, &Options)
impl TryConvert<Vec<PgColumn>> for (&Vec<OdbcColumn>, &Vec<PgTableItem>, &Options)
Source§impl TryConvert<BufferDescription> for (&OdbcColumn, &Options)
impl TryConvert<BufferDescription> for (&OdbcColumn, &Options)
type Error = String
fn try_convert(self) -> Result<BufferDescription, Self::Error>
Source§impl TryConvert<PgTableDesc> for (TableDescResult, &Options)
impl TryConvert<PgTableDesc> for (TableDescResult, &Options)
type Error = Error
fn try_convert(self) -> Result<PgTableDesc, Self::Error>
Source§impl TryConvert<PgTableItem> for DmTableItem
impl TryConvert<PgTableItem> for DmTableItem
type Error = Error
fn try_convert(self) -> Result<PgTableItem, Self::Error>
Source§impl TryConvert<Type> for DmDateType
impl TryConvert<Type> for DmDateType
Source§impl TryConvert<Date> for Date
Convert odbc_api::sys::Date
to time::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());
Source§impl TryConvert<PrimitiveDateTime> for Timestamp
impl TryConvert<PrimitiveDateTime> for Timestamp
type Error = Error
fn try_convert(self) -> Result<PrimitiveDateTime, Self::Error>
Source§impl TryConvert<Time> for Time
Convert odbc_api::sys::Time
to time::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());
Implementors§
Source§impl TryConvert<DmTableDesc> for TableDescResult
impl TryConvert<DmTableDesc> for TableDescResult
Source§impl<T: StatementInput> TryConvert<Either<Vec<Box<dyn InputParameter>>, ()>> for T
TryConvert State StatementInput
trait to EitherBoxParams
impl<T: StatementInput> TryConvert<Either<Vec<Box<dyn InputParameter>>, ()>> for T
TryConvert State StatementInput
trait to EitherBoxParams
§Example
use either::Either;
use odbc_api::parameter::InputParameter;
use odbc_api_helper::executor::statement::Statement;
use odbc_api_helper::extension::pg::PgValueInput;
use odbc_api_helper::TryConvert;
let statement = Statement::new("select * from empty where name=? and age=?",vec![
PgValueInput::VARCHAR("foo".into()),
PgValueInput::INT2(8)
]);
let left:Vec<Box<dyn InputParameter>> = statement.try_convert().unwrap().left().unwrap();
assert_eq!(left.len(),2);
let statement = "select * from empty where name=? and age=?";
let right:() = statement.try_convert().unwrap().right().unwrap();///
assert_eq!(right,());