| 1 | use craterust-analyzer cargo sqlx-core 0.8.3 crate/::anyrust-analyzer cargo sqlx-core 0.8.3 any/::{Anyrust-analyzer cargo sqlx-core 0.8.3 any/database/Any#, AnyArgumentsrust-analyzer cargo sqlx-core 0.8.3 any/arguments/AnyArguments#, AnyColumnrust-analyzer cargo sqlx-core 0.8.3 any/column/AnyColumn#, AnyTypeInforust-analyzer cargo sqlx-core 0.8.3 any/type_info/AnyTypeInfo#}; |
| 2 | use craterust-analyzer cargo sqlx-core 0.8.3 crate/::columnrust-analyzer cargo sqlx-core 0.8.3 column/::ColumnIndexrust-analyzer cargo sqlx-core 0.8.3 column/ColumnIndex#; |
| 3 | use craterust-analyzer cargo sqlx-core 0.8.3 crate/::databaserust-analyzer cargo sqlx-core 0.8.3 database/::Databaserust-analyzer cargo sqlx-core 0.8.3 database/Database#; |
| 4 | use craterust-analyzer cargo sqlx-core 0.8.3 crate/::errorrust-analyzer cargo sqlx-core 0.8.3 error/::Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#; |
| 5 | use craterust-analyzer cargo sqlx-core 0.8.3 crate/::extrust-analyzer cargo sqlx-core 0.8.3 ext/::ustrrust-analyzer cargo sqlx-core 0.8.3 ext/ustr/::UStrrust-analyzer cargo sqlx-core 0.8.3 ext/ustr/UStr#; |
| 6 | use craterust-analyzer cargo sqlx-core 0.8.3 crate/::statementrust-analyzer cargo sqlx-core 0.8.3 statement/::Statementrust-analyzer cargo sqlx-core 0.8.3 statement/Statement#; |
| 7 | use craterust-analyzer cargo sqlx-core 0.8.3 crate/::HashMaprust-analyzer cargo hashbrown 0.17.1 map/HashMap#; |
| 8 | use eitherrust-analyzer cargo either 1.18.0 crate/::Eitherrust-analyzer cargo either 1.18.0 Either#; |
| 9 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#; |
| 10 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#; |
| 11 | |
| 12 | pub struct AnyStatementrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#<'q> { |
| 13 | #[doc(hidden)] |
| 14 | pub sqlrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#sql.: Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'q, str>, |
| 15 | #[doc(hidden)] |
| 16 | pub parametersrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#parameters.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Eitherrust-analyzer cargo either 1.18.0 Either#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<AnyTypeInforust-analyzer cargo sqlx-core 0.8.3 any/type_info/AnyTypeInfo#>, usize>>, |
| 17 | #[doc(hidden)] |
| 18 | pub column_namesrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#column_names.: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<HashMaprust-analyzer cargo hashbrown 0.17.1 map/HashMap#<UStrrust-analyzer cargo sqlx-core 0.8.3 ext/ustr/UStr#, usize>>, |
| 19 | #[doc(hidden)] |
| 20 | pub columnsrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#columns.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<AnyColumnrust-analyzer cargo sqlx-core 0.8.3 any/column/AnyColumn#>, |
| 21 | } |
| 22 | |
| 23 | impl<'q> Statementrust-analyzer cargo sqlx-core 0.8.3 statement/Statement#<'q> for AnyStatementrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#<'q> { |
| 24 | type Databaserust-analyzer cargo sqlx-core 0.8.3 any/statement/impl#[`AnyStatement<'q>`][`Statement<'q>`]Database# = Anyrust-analyzer cargo sqlx-core 0.8.3 any/database/Any#; |
| 25 | |
| 26 | fn to_ownedrust-analyzer cargo sqlx-core 0.8.3 any/statement/impl#[`AnyStatement<'q>`][`Statement<'q>`]to_owned().(&self) -> AnyStatementrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#<'static> { |
| 27 | AnyStatementrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#::<'static> { |
| 28 | sqlrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#sql.: Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Owned#(self.sqlrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#sql..clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`][Clone]clone().().into_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`]into_owned().()), |
| 29 | column_namesrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#column_names.: self.column_namesrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#column_names..clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().(), |
| 30 | parametersrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#parameters.: self.parametersrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#parameters..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Clone]clone().(), |
| 31 | columnsrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#columns.: self.columnsrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#columns..clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().(), |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | fn sqlrust-analyzer cargo sqlx-core 0.8.3 any/statement/impl#[`AnyStatement<'q>`][`Statement<'q>`]sql().(&self) -> &str { |
| 36 | &self.sqlrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#sql. |
| 37 | } |
| 38 | |
| 39 | fn parametersrust-analyzer cargo sqlx-core 0.8.3 any/statement/impl#[`AnyStatement<'q>`][`Statement<'q>`]parameters().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Eitherrust-analyzer cargo either 1.18.0 Either#<&[AnyTypeInforust-analyzer cargo sqlx-core 0.8.3 any/type_info/AnyTypeInfo#], usize>> { |
| 40 | match &self.parametersrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#parameters. { |
| 41 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Eitherrust-analyzer cargo either 1.18.0 Either#::Leftrust-analyzer cargo either 1.18.0 Either#Left#(types)) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Eitherrust-analyzer cargo either 1.18.0 Either#::Leftrust-analyzer cargo either 1.18.0 Either#Left#(types)), |
| 42 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Eitherrust-analyzer cargo either 1.18.0 Either#::Rightrust-analyzer cargo either 1.18.0 Either#Right#(count)) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Eitherrust-analyzer cargo either 1.18.0 Either#::Rightrust-analyzer cargo either 1.18.0 Either#Right#(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().count)), |
| 43 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | fn columnsrust-analyzer cargo sqlx-core 0.8.3 any/statement/impl#[`AnyStatement<'q>`][`Statement<'q>`]columns().(&self) -> &[AnyColumnrust-analyzer cargo sqlx-core 0.8.3 any/column/AnyColumn#] { |
| 48 | &self.columnsrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#columns. |
| 49 | } |
| 50 | |
| 51 | impl_statement_queryrust-analyzer cargo sqlx-core 0.8.3 statement/impl_statement_query!!(AnyArgumentsrust-analyzer cargo sqlx-core 0.8.3 any/arguments/AnyArguments#<'_>); |
| 52 | } |
| 53 | |
| 54 | impl<'i> ColumnIndexrust-analyzer cargo sqlx-core 0.8.3 column/ColumnIndex#<AnyStatementrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#<'_>> for &'i str { |
| 55 | fn indexrust-analyzer cargo sqlx-core 0.8.3 any/statement/impl#[`&'i str`][`ColumnIndex<AnyStatement<'_>>`]index().(&self, statement: &AnyStatementrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#<'_>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<usize, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 56 | statement |
| 57 | .column_namesrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#column_names. |
| 58 | .getrust-analyzer cargo hashbrown 0.17.1 map/impl#[`HashMap<K, V, S, A>`]get().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self) |
| 59 | .ok_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or_else().(|| Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#::ColumnNotFoundrust-analyzer cargo sqlx-core 0.8.3 error/Error#ColumnNotFound#((*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 60 | .copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<&T, E>`]copied().() |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | impl<'q> AnyStatementrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#<'q> { |
| 65 | #[doc(hidden)] |
| 66 | pub fn try_from_statementrust-analyzer cargo sqlx-core 0.8.3 any/statement/impl#[`AnyStatement<'q>`]try_from_statement().<S>( |
| 67 | query: &'q str, |
| 68 | statement: &S, |
| 69 | column_names: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<HashMaprust-analyzer cargo hashbrown 0.17.1 map/HashMap#<UStrrust-analyzer cargo sqlx-core 0.8.3 ext/ustr/UStr#, usize>>, |
| 70 | ) -> craterust-analyzer cargo sqlx-core 0.8.3 crate/::Resultrust-analyzer cargo sqlx-core 0.8.3 error/Result#<Selfrust-analyzer cargo sqlx-core 0.8.3 any/statement/impl#[`AnyStatement<'q>`]> |
| 71 | where |
| 72 | S: Statementrust-analyzer cargo sqlx-core 0.8.3 statement/Statement#<'q>, |
| 73 | AnyTypeInforust-analyzer cargo sqlx-core 0.8.3 any/type_info/AnyTypeInfo#: for<'a> TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<&'a <S::Databaserust-analyzer cargo sqlx-core 0.8.3 statement/Statement#Database# as Databaserust-analyzer cargo sqlx-core 0.8.3 database/Database#>::TypeInforust-analyzer cargo sqlx-core 0.8.3 database/Database#TypeInfo#, Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error# = Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>, |
| 74 | AnyColumnrust-analyzer cargo sqlx-core 0.8.3 any/column/AnyColumn#: for<'a> TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<&'a <S::Databaserust-analyzer cargo sqlx-core 0.8.3 statement/Statement#Database# as Databaserust-analyzer cargo sqlx-core 0.8.3 database/Database#>::Columnrust-analyzer cargo sqlx-core 0.8.3 database/Database#Column#, Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error# = Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>, |
| 75 | { |
| 76 | let parameters = match statement.parametersrust-analyzer cargo sqlx-core 0.8.3 statement/Statement#parameters().() { |
| 77 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Eitherrust-analyzer cargo either 1.18.0 Either#::Leftrust-analyzer cargo either 1.18.0 Either#Left#(parameters)) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Eitherrust-analyzer cargo either 1.18.0 Either#::Leftrust-analyzer cargo either 1.18.0 Either#Left#( |
| 78 | parameters |
| 79 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 80 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(AnyTypeInforust-analyzer cargo sqlx-core 0.8.3 any/type_info/AnyTypeInfo#::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#try_from().) |
| 81 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>, _>>()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 82 | )), |
| 83 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Eitherrust-analyzer cargo either 1.18.0 Either#::Rightrust-analyzer cargo either 1.18.0 Either#Right#(count)) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Eitherrust-analyzer cargo either 1.18.0 Either#::Rightrust-analyzer cargo either 1.18.0 Either#Right#(count)), |
| 84 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 85 | }; |
| 86 | |
| 87 | let columns = statement |
| 88 | .columnsrust-analyzer cargo sqlx-core 0.8.3 statement/Statement#columns().() |
| 89 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 90 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(AnyColumnrust-analyzer cargo sqlx-core 0.8.3 any/column/AnyColumn#::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#try_from().) |
| 91 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>, _>>()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 92 | |
| 93 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo sqlx-core 0.8.3 any/statement/impl#[`AnyStatement<'q>`] { |
| 94 | sqlrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#sql.: query.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 95 | columnsrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#columns., |
| 96 | column_namesrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#column_names., |
| 97 | parametersrust-analyzer cargo sqlx-core 0.8.3 any/statement/AnyStatement#parameters., |
| 98 | }) |
| 99 | } |
| 100 | } |