| 1 | use synrust-analyzer cargo syn 2.0.119 crate/::parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/; |
| 2 | use synrust-analyzer cargo syn 2.0.119 crate/::punctuatedrust-analyzer cargo syn 2.0.119 punctuated/::Punctuatedrust-analyzer cargo syn 2.0.119 punctuated/Punctuated#; |
| 3 | use synrust-analyzer cargo syn 2.0.119 crate/::spannedrust-analyzer cargo syn 2.0.119 spanned/::Spannedrust-analyzer cargo syn 2.0.119 spanned/Spanned#; |
| 4 | |
| 5 | use craterust-analyzer cargo blanket 0.4.0 crate/::utilsrust-analyzer cargo blanket 0.4.0 utils/::deref_exprrust-analyzer cargo blanket 0.4.0 utils/deref_expr().; |
| 6 | use craterust-analyzer cargo blanket 0.4.0 crate/::utilsrust-analyzer cargo blanket 0.4.0 utils/::generics_declaration_to_genericsrust-analyzer cargo blanket 0.4.0 utils/generics_declaration_to_generics().; |
| 7 | use craterust-analyzer cargo blanket 0.4.0 crate/::utilsrust-analyzer cargo blanket 0.4.0 utils/::signature_to_associated_function_callrust-analyzer cargo blanket 0.4.0 utils/signature_to_associated_function_call().; |
| 8 | use craterust-analyzer cargo blanket 0.4.0 crate/::utilsrust-analyzer cargo blanket 0.4.0 utils/::signature_to_method_callrust-analyzer cargo blanket 0.4.0 utils/signature_to_method_call().; |
| 9 | use craterust-analyzer cargo blanket 0.4.0 crate/::utilsrust-analyzer cargo blanket 0.4.0 utils/::trait_to_generic_identrust-analyzer cargo blanket 0.4.0 utils/trait_to_generic_ident().; |
| 10 | |
| 11 | /// The different receivers supported on a method. |
| 12 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 13 | pub enum Receiverrust-analyzer cargo blanket 0.4.0 derive/Receiver# { |
| 14 | Arbitraryrust-analyzer cargo blanket 0.4.0 derive/Receiver#Arbitrary#, |
| 15 | Refrust-analyzer cargo blanket 0.4.0 derive/Receiver#Ref#, |
| 16 | Mutrust-analyzer cargo blanket 0.4.0 derive/Receiver#Mut#, |
| 17 | Ownedrust-analyzer cargo blanket 0.4.0 derive/Receiver#Owned#, |
| 18 | } |
| 19 | |
| 20 | /// A marker trait for types wrapping a single other type. |
| 21 | pub trait WrapperTyperust-analyzer cargo blanket 0.4.0 derive/WrapperType# { |
| 22 | /// A short name for the type being wrapper. |
| 23 | const NAMErust-analyzer cargo blanket 0.4.0 derive/WrapperType#NAME.: &'static str; |
| 24 | |
| 25 | /// The receivers allowed for this wrapper type. |
| 26 | const RECEIVERSrust-analyzer cargo blanket 0.4.0 derive/WrapperType#RECEIVERS.: &'static [Receiverrust-analyzer cargo blanket 0.4.0 derive/Receiver#]; |
| 27 | |
| 28 | /// Additional types to add to the generic type bound. |
| 29 | const BOUNDSrust-analyzer cargo blanket 0.4.0 derive/WrapperType#BOUNDS.: &'static [&'static str] = &[]; |
| 30 | |
| 31 | /// Wrap the given identifier into the wrapper type. |
| 32 | fn wraprust-analyzer cargo blanket 0.4.0 derive/WrapperType#wrap().(ty: &synrust-analyzer cargo syn 2.0.119 crate/::Identrust-analyzer cargo proc-macro2 1.0.107 Ident#) -> synrust-analyzer cargo syn 2.0.119 crate/::Typerust-analyzer cargo syn 2.0.119 ty/Type#; |
| 33 | |
| 34 | /// Check that the given receiver is supported for the wrapper type. |
| 35 | fn check_receiverrust-analyzer cargo blanket 0.4.0 derive/WrapperType#check_receiver().(r: &synrust-analyzer cargo syn 2.0.119 crate/::Receiverrust-analyzer cargo syn 2.0.119 item/Receiver#) -> synrust-analyzer cargo syn 2.0.119 crate/::Resultrust-analyzer cargo syn 2.0.119 error/Result#<()> { |
| 36 | let receivers = Self::RECEIVERSrust-analyzer cargo blanket 0.4.0 derive/WrapperType#RECEIVERS.; |
| 37 | let err = if r.colon_tokenrust-analyzer cargo syn 2.0.119 item/Receiver#colon_token..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().receivers.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&Receiverrust-analyzer cargo blanket 0.4.0 derive/Receiver#::Arbitraryrust-analyzer cargo blanket 0.4.0 derive/Receiver#Arbitrary#) { |
| 38 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 39 | "cannot derive `{}` for a trait declaring methods with arbitrary receiver types", |
| 40 | Self::NAMErust-analyzer cargo blanket 0.4.0 derive/WrapperType#NAME. |
| 41 | )) |
| 42 | } else if r.mutabilityrust-analyzer cargo syn 2.0.119 item/Receiver#mutability..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().receivers.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&Receiverrust-analyzer cargo blanket 0.4.0 derive/Receiver#::Mutrust-analyzer cargo blanket 0.4.0 derive/Receiver#Mut#) { |
| 43 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 44 | "cannot derive `{}` for a trait declaring `&mut self` methods", |
| 45 | Self::NAMErust-analyzer cargo blanket 0.4.0 derive/WrapperType#NAME. |
| 46 | )) |
| 47 | } else if r.referencerust-analyzer cargo syn 2.0.119 item/Receiver#reference..is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().receivers.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&Receiverrust-analyzer cargo blanket 0.4.0 derive/Receiver#::Ownedrust-analyzer cargo blanket 0.4.0 derive/Receiver#Owned#) { |
| 48 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 49 | "cannot derive `{}` for a trait declaring `self` methods", |
| 50 | Self::NAMErust-analyzer cargo blanket 0.4.0 derive/WrapperType#NAME. |
| 51 | )) |
| 52 | } else { |
| 53 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 54 | }; |
| 55 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(msg) = err { |
| 56 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error#::newrust-analyzer cargo syn 2.0.119 error/impl#[Error]new().(r.spanrust-analyzer cargo syn 2.0.119 spanned/impl#[T][Spanned]span().(), msg)) |
| 57 | } else { |
| 58 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | /// Generate the derived implementation for the given trait. |
| 63 | fn deriverust-analyzer cargo blanket 0.4.0 derive/WrapperType#derive().(trait_: &synrust-analyzer cargo syn 2.0.119 crate/::ItemTraitrust-analyzer cargo syn 2.0.119 item/ItemTrait#) -> synrust-analyzer cargo syn 2.0.119 crate/::Resultrust-analyzer cargo syn 2.0.119 error/Result#<synrust-analyzer cargo syn 2.0.119 crate/::ItemImplrust-analyzer cargo syn 2.0.119 item/ItemImpl#> { |
| 64 | // build an identifier for the generic type used for the implementation |
| 65 | let trait_ident = &trait_.identrust-analyzer cargo syn 2.0.119 item/ItemTrait#ident.; |
| 66 | let generic_type = trait_to_generic_identrust-analyzer cargo blanket 0.4.0 utils/trait_to_generic_ident().(trait_); |
| 67 | let wrapper_type = Self::wraprust-analyzer cargo blanket 0.4.0 derive/WrapperType#wrap().(&generic_type); |
| 68 | |
| 69 | // build the generics for the impl block: |
| 70 | // we use the same generics as the trait itself, plus |
| 71 | // a generic type that implements the trait for which we provide the |
| 72 | // blanket implementation |
| 73 | let trait_generics = &trait_.genericsrust-analyzer cargo syn 2.0.119 item/ItemTrait#generics.; |
| 74 | let where_clause = &trait_.genericsrust-analyzer cargo syn 2.0.119 item/ItemTrait#generics..where_clauserust-analyzer cargo syn 2.0.119 generics/Generics#where_clause.; |
| 75 | let mut impl_generics = trait_generics.clonerust-analyzer cargo syn 2.0.119 gen/clone/impl#[`crate::Generics`][Clone]clone().(); |
| 76 | |
| 77 | // we must however remove the generic type bounds, to avoid repeating them |
| 78 | let mut trait_generic_names = trait_generics.clonerust-analyzer cargo syn 2.0.119 gen/clone/impl#[`crate::Generics`][Clone]clone().(); |
| 79 | trait_generic_names.paramsrust-analyzer cargo syn 2.0.119 generics/Generics#params. = generics_declaration_to_genericsrust-analyzer cargo blanket 0.4.0 utils/generics_declaration_to_generics().(&trait_generics.paramsrust-analyzer cargo syn 2.0.119 generics/Generics#params.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 80 | |
| 81 | // build the methods |
| 82 | let mut methods: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<synrust-analyzer cargo syn 2.0.119 crate/::ImplItemFnrust-analyzer cargo syn 2.0.119 item/ImplItemFn#> = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 83 | let mut assoc_types: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<synrust-analyzer cargo syn 2.0.119 crate/::ImplItemTyperust-analyzer cargo syn 2.0.119 item/ImplItemType#> = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 84 | for item in trait_.itemsrust-analyzer cargo syn 2.0.119 item/ItemTrait#items..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() { |
| 85 | if let synrust-analyzer cargo syn 2.0.119 crate/::TraitItemrust-analyzer cargo syn 2.0.119 item/TraitItem#::Fnrust-analyzer cargo syn 2.0.119 item/TraitItem#Fn#(ref m) = item { |
| 86 | methods.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Self::derive_methodrust-analyzer cargo blanket 0.4.0 derive/WrapperType#derive_method().( |
| 87 | m, |
| 88 | trait_ident, |
| 89 | &generic_type, |
| 90 | &trait_generic_names, |
| 91 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().) |
| 92 | } |
| 93 | |
| 94 | if let synrust-analyzer cargo syn 2.0.119 crate/::TraitItemrust-analyzer cargo syn 2.0.119 item/TraitItem#::Typerust-analyzer cargo syn 2.0.119 item/TraitItem#Type#(t) = item { |
| 95 | let t_ident = &t.identrust-analyzer cargo syn 2.0.119 item/TraitItemType#ident.; |
| 96 | let attrs = &t.attrsrust-analyzer cargo syn 2.0.119 item/TraitItemType#attrs.; |
| 97 | |
| 98 | let t_generics = &t.genericsrust-analyzer cargo syn 2.0.119 item/TraitItemType#generics.; |
| 99 | let where_clause = &t.genericsrust-analyzer cargo syn 2.0.119 item/TraitItemType#generics..where_clauserust-analyzer cargo syn 2.0.119 generics/Generics#where_clause.; |
| 100 | let mut t_generic_names = t_generics.clonerust-analyzer cargo syn 2.0.119 gen/clone/impl#[`crate::Generics`][Clone]clone().(); |
| 101 | t_generic_names.paramsrust-analyzer cargo syn 2.0.119 generics/Generics#params. = generics_declaration_to_genericsrust-analyzer cargo blanket 0.4.0 utils/generics_declaration_to_generics().(&t_generics.paramsrust-analyzer cargo syn 2.0.119 generics/Generics#params.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 102 | |
| 103 | let item = parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!( #(#attrs)* type #t_ident #t_generics = <#generic_type as #trait_ident #trait_generic_names>::#t_ident #t_generic_names #where_clause ; ); |
| 104 | assoc_types.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(item); |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | // check if any method has a `Self` receiver, which would mean we cannot |
| 109 | // relax the `Sized` trait requirement |
| 110 | let mut sized = false; |
| 111 | for item in trait_.itemsrust-analyzer cargo syn 2.0.119 item/ItemTrait#items..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() { |
| 112 | if let synrust-analyzer cargo syn 2.0.119 crate/::TraitItemrust-analyzer cargo syn 2.0.119 item/TraitItem#::Fnrust-analyzer cargo syn 2.0.119 item/TraitItem#Fn#(ref m) = item { |
| 113 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(r) = m.sigrust-analyzer cargo syn 2.0.119 item/TraitItemFn#sig..receiverrust-analyzer cargo syn 2.0.119 item/impl#[Signature]receiver().() { |
| 114 | sized rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOrAssign<Self>`]bitor_assign().r.referencerust-analyzer cargo syn 2.0.119 item/Receiver#reference..is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().(); |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | // Add generic type for the type we are creating ourselves |
| 120 | let span = generic_type.spanrust-analyzer cargo proc-macro2 1.0.107 impl#[Ident]span().(); |
| 121 | let mut bounds: Punctuatedrust-analyzer cargo syn 2.0.119 punctuated/Punctuated#<_, _> = parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(#trait_ident #trait_generic_names); |
| 122 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().sized { |
| 123 | bounds.pushrust-analyzer cargo syn 2.0.119 punctuated/impl#[`Punctuated<T, P>`]push().(parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(?Sized)); |
| 124 | } |
| 125 | for bound in Self::BOUNDSrust-analyzer cargo blanket 0.4.0 derive/WrapperType#BOUNDS. { |
| 126 | let bound_ident = synrust-analyzer cargo syn 2.0.119 crate/::Identrust-analyzer cargo proc-macro2 1.0.107 Ident#::newrust-analyzer cargo proc-macro2 1.0.107 impl#[Ident]new().(bound, span); |
| 127 | bounds.pushrust-analyzer cargo syn 2.0.119 punctuated/impl#[`Punctuated<T, P>`]push().(parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(#bound_ident)) |
| 128 | } |
| 129 | |
| 130 | // Add the type wrapper in the wrapper type for the generic. |
| 131 | impl_generics |
| 132 | .paramsrust-analyzer cargo syn 2.0.119 generics/Generics#params. |
| 133 | .pushrust-analyzer cargo syn 2.0.119 punctuated/impl#[`Punctuated<T, P>`]push().(synrust-analyzer cargo syn 2.0.119 crate/::GenericParamrust-analyzer cargo syn 2.0.119 generics/GenericParam#::Typerust-analyzer cargo syn 2.0.119 generics/GenericParam#Type#(synrust-analyzer cargo syn 2.0.119 crate/::TypeParamrust-analyzer cargo syn 2.0.119 generics/TypeParam# { |
| 134 | attrsrust-analyzer cargo syn 2.0.119 generics/TypeParam#attrs.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 135 | identrust-analyzer cargo syn 2.0.119 generics/TypeParam#ident.: generic_type.clonerust-analyzer cargo proc-macro2 1.0.107 impl#[Ident][Clone]clone().(), |
| 136 | colon_tokenrust-analyzer cargo syn 2.0.119 generics/TypeParam#colon_token.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(synrust-analyzer cargo syn 2.0.119 crate/::Tokenrust-analyzer cargo syn 2.0.119 token/Token!), |
| 137 | boundsrust-analyzer cargo syn 2.0.119 generics/TypeParam#bounds., |
| 138 | eq_tokenrust-analyzer cargo syn 2.0.119 generics/TypeParam#eq_token.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 139 | defaultrust-analyzer cargo syn 2.0.119 generics/TypeParam#default.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 140 | })); |
| 141 | |
| 142 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!( |
| 143 | #[automatically_derived] |
| 144 | impl #impl_generics #trait_ident #trait_generic_names for #wrapper_type #where_clause { |
| 145 | #(#assoc_types)* |
| 146 | #(#methods)* |
| 147 | } |
| 148 | )) |
| 149 | } |
| 150 | |
| 151 | /// Generate the derived implementation for a single method of a trait. |
| 152 | fn derive_methodrust-analyzer cargo blanket 0.4.0 derive/WrapperType#derive_method().( |
| 153 | m: &synrust-analyzer cargo syn 2.0.119 crate/::TraitItemFnrust-analyzer cargo syn 2.0.119 item/TraitItemFn#, |
| 154 | trait_ident: &synrust-analyzer cargo syn 2.0.119 crate/::Identrust-analyzer cargo proc-macro2 1.0.107 Ident#, |
| 155 | generic_type: &synrust-analyzer cargo syn 2.0.119 crate/::Identrust-analyzer cargo proc-macro2 1.0.107 Ident#, |
| 156 | trait_generic_names: &synrust-analyzer cargo syn 2.0.119 crate/::Genericsrust-analyzer cargo syn 2.0.119 generics/Generics#, |
| 157 | ) -> synrust-analyzer cargo syn 2.0.119 crate/::Resultrust-analyzer cargo syn 2.0.119 error/Result#<synrust-analyzer cargo syn 2.0.119 crate/::ImplItemFnrust-analyzer cargo syn 2.0.119 item/ImplItemFn#> { |
| 158 | let mut call: synrust-analyzer cargo syn 2.0.119 crate/::Exprrust-analyzer cargo syn 2.0.119 expr/Expr# = if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(r) = m.sigrust-analyzer cargo syn 2.0.119 item/TraitItemFn#sig..receiverrust-analyzer cargo syn 2.0.119 item/impl#[Signature]receiver().() { |
| 159 | Self::check_receiverrust-analyzer cargo blanket 0.4.0 derive/WrapperType#check_receiver().(r)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 160 | let mut call = signature_to_method_callrust-analyzer cargo blanket 0.4.0 utils/signature_to_method_call().(&m.sigrust-analyzer cargo syn 2.0.119 item/TraitItemFn#sig.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 161 | if r.referencerust-analyzer cargo syn 2.0.119 item/Receiver#reference..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() { |
| 162 | call.receiverrust-analyzer cargo syn 2.0.119 expr/ExprMethodCall#receiver. = Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(deref_exprrust-analyzer cargo blanket 0.4.0 utils/deref_expr().(deref_exprrust-analyzer cargo blanket 0.4.0 utils/deref_expr().(*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][Deref]deref().call.receiverrust-analyzer cargo syn 2.0.119 expr/ExprMethodCall#receiver.))); |
| 163 | } else { |
| 164 | call.receiverrust-analyzer cargo syn 2.0.119 expr/ExprMethodCall#receiver. = Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(deref_exprrust-analyzer cargo blanket 0.4.0 utils/deref_expr().(*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][Deref]deref().call.receiverrust-analyzer cargo syn 2.0.119 expr/ExprMethodCall#receiver.)); |
| 165 | } |
| 166 | call.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 167 | } else { |
| 168 | let call = signature_to_associated_function_callrust-analyzer cargo blanket 0.4.0 utils/signature_to_associated_function_call().( |
| 169 | &m.sigrust-analyzer cargo syn 2.0.119 item/TraitItemFn#sig., |
| 170 | trait_ident, |
| 171 | generic_type, |
| 172 | trait_generic_names, |
| 173 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 174 | call.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 175 | }; |
| 176 | |
| 177 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(async_) = m.sigrust-analyzer cargo syn 2.0.119 item/TraitItemFn#sig..asyncnessrust-analyzer cargo syn 2.0.119 item/Signature#asyncness. { |
| 178 | let span = async_.spanrust-analyzer cargo syn 2.0.119 spanned/impl#[T][Spanned]span().(); |
| 179 | call = synrust-analyzer cargo syn 2.0.119 crate/::ExprAwaitrust-analyzer cargo syn 2.0.119 expr/ExprAwait# { |
| 180 | attrsrust-analyzer cargo syn 2.0.119 expr/ExprAwait#attrs.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 181 | baserust-analyzer cargo syn 2.0.119 expr/ExprAwait#base.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(call), |
| 182 | dot_tokenrust-analyzer cargo syn 2.0.119 expr/ExprAwait#dot_token.: synrust-analyzer cargo syn 2.0.119 crate/::Tokenrust-analyzer cargo syn 2.0.119 token/Token!, |
| 183 | await_tokenrust-analyzer cargo syn 2.0.119 expr/ExprAwait#await_token.: synrust-analyzer cargo syn 2.0.119 crate/::Tokenrust-analyzer cargo syn 2.0.119 token/Token!, |
| 184 | } |
| 185 | .intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 186 | } |
| 187 | |
| 188 | let signature = &m.sigrust-analyzer cargo syn 2.0.119 item/TraitItemFn#sig.; |
| 189 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(synrust-analyzer cargo syn 2.0.119 crate/::parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(#[inline] #signature { #call })) |
| 190 | } |
| 191 | } |