| 1 | 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#, Attributerust-analyzer cargo syn 2.0.119 attr/Attribute#, Metarust-analyzer cargo syn 2.0.119 attr/Meta#, Tokenrust-analyzer cargo syn 2.0.119 token/Token!}; |
| 2 | |
| 3 | use craterust-analyzer cargo educe 0.6.0 crate/::{panicrust-analyzer cargo educe 0.6.0 panic/, supported_traitsrust-analyzer cargo educe 0.6.0 supported_traits/::Traitrust-analyzer cargo educe 0.6.0 supported_traits/Trait#}; |
| 4 | |
| 5 | pub(craterust-analyzer cargo educe 0.6.0 crate/) struct FieldAttributerust-analyzer cargo educe 0.6.0 trait_handlers/eq/models/field_attribute/FieldAttribute#; |
| 6 | |
| 7 | pub(craterust-analyzer cargo educe 0.6.0 crate/) struct FieldAttributeBuilderrust-analyzer cargo educe 0.6.0 trait_handlers/eq/models/field_attribute/FieldAttributeBuilder#; |
| 8 | |
| 9 | impl FieldAttributeBuilderrust-analyzer cargo educe 0.6.0 trait_handlers/eq/models/field_attribute/FieldAttributeBuilder# { |
| 10 | pub(craterust-analyzer cargo educe 0.6.0 crate/) fn build_from_eq_metarust-analyzer cargo educe 0.6.0 trait_handlers/eq/models/field_attribute/impl#[FieldAttributeBuilder]build_from_eq_meta().(&self, meta: &Metarust-analyzer cargo syn 2.0.119 attr/Meta#) -> synrust-analyzer cargo syn 2.0.119 crate/::Resultrust-analyzer cargo syn 2.0.119 error/Result#<FieldAttributerust-analyzer cargo educe 0.6.0 trait_handlers/eq/models/field_attribute/FieldAttribute#> { |
| 11 | debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(meta.pathrust-analyzer cargo syn 2.0.119 attr/impl#[Meta]path().().is_identrust-analyzer cargo syn 2.0.119 path/impl#[Path]is_ident().("Eq")); |
| 12 | |
| 13 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(panicrust-analyzer cargo educe 0.6.0 panic/::attribute_incorrect_placerust-analyzer cargo educe 0.6.0 panic/attribute_incorrect_place().(meta.pathrust-analyzer cargo syn 2.0.119 attr/impl#[Meta]path().().get_identrust-analyzer cargo syn 2.0.119 path/impl#[Path]get_ident().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().())); |
| 14 | } |
| 15 | |
| 16 | pub(craterust-analyzer cargo educe 0.6.0 crate/) fn build_from_attributesrust-analyzer cargo educe 0.6.0 trait_handlers/eq/models/field_attribute/impl#[FieldAttributeBuilder]build_from_attributes().( |
| 17 | &self, |
| 18 | attributes: &[Attributerust-analyzer cargo syn 2.0.119 attr/Attribute#], |
| 19 | traits: &[Traitrust-analyzer cargo educe 0.6.0 supported_traits/Trait#], |
| 20 | ) -> synrust-analyzer cargo syn 2.0.119 crate/::Resultrust-analyzer cargo syn 2.0.119 error/Result#<FieldAttributerust-analyzer cargo educe 0.6.0 trait_handlers/eq/models/field_attribute/FieldAttribute#> { |
| 21 | let mut output = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 22 | |
| 23 | for attribute in attributes.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() { |
| 24 | let path = attribute.pathrust-analyzer cargo syn 2.0.119 attr/impl#[Attribute]path().(); |
| 25 | |
| 26 | if path.is_identrust-analyzer cargo syn 2.0.119 path/impl#[Path]is_ident().("educe") { |
| 27 | if let Metarust-analyzer cargo syn 2.0.119 attr/Meta#::Listrust-analyzer cargo syn 2.0.119 attr/Meta#List#(list) = &attribute.metarust-analyzer cargo syn 2.0.119 attr/Attribute#meta. { |
| 28 | let result = |
| 29 | list.parse_args_withrust-analyzer cargo syn 2.0.119 attr/impl#[MetaList]parse_args_with().(Punctuatedrust-analyzer cargo syn 2.0.119 punctuated/Punctuated#::<Metarust-analyzer cargo syn 2.0.119 attr/Meta#, Tokenrust-analyzer cargo syn 2.0.119 token/Token!![,]>::parse_terminatedrust-analyzer cargo syn 2.0.119 punctuated/impl#[`Punctuated<T, P>`]parse_terminated().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 30 | |
| 31 | for meta in result { |
| 32 | let path = meta.pathrust-analyzer cargo syn 2.0.119 attr/impl#[Meta]path().(); |
| 33 | |
| 34 | let t = match Traitrust-analyzer cargo educe 0.6.0 supported_traits/Trait#::from_pathrust-analyzer cargo educe 0.6.0 supported_traits/impl#[Trait]from_path().(path) { |
| 35 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(t) => t, |
| 36 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(panicrust-analyzer cargo educe 0.6.0 panic/::unsupported_traitrust-analyzer cargo educe 0.6.0 panic/unsupported_trait().(meta.pathrust-analyzer cargo syn 2.0.119 attr/impl#[Meta]path().())), |
| 37 | }; |
| 38 | |
| 39 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().traits.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&t) { |
| 40 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(panicrust-analyzer cargo educe 0.6.0 panic/::trait_not_usedrust-analyzer cargo educe 0.6.0 panic/trait_not_used().(path.get_identrust-analyzer cargo syn 2.0.119 path/impl#[Path]get_ident().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().())); |
| 41 | } |
| 42 | |
| 43 | if t rust-analyzer cargo educe 0.6.0 supported_traits/impl#[Trait][`PartialEq<Self>`]eq().==rust-analyzer cargo educe 0.6.0 supported_traits/impl#[Trait][`PartialEq<Self>`]eq(). rust-analyzer cargo educe 0.6.0 supported_traits/impl#[Trait][`PartialEq<Self>`]eq().Traitrust-analyzer cargo educe 0.6.0 supported_traits/Trait#::Eqrust-analyzer cargo educe 0.6.0 supported_traits/Trait#Eq# { |
| 44 | if output.is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() { |
| 45 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(panicrust-analyzer cargo educe 0.6.0 panic/::reuse_a_traitrust-analyzer cargo educe 0.6.0 panic/reuse_a_trait().(path.get_identrust-analyzer cargo syn 2.0.119 path/impl#[Path]get_ident().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().())); |
| 46 | } |
| 47 | |
| 48 | output = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.build_from_eq_metarust-analyzer cargo educe 0.6.0 trait_handlers/eq/models/field_attribute/impl#[FieldAttributeBuilder]build_from_eq_meta().(&meta)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().); |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(output.unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(FieldAttributerust-analyzer cargo educe 0.6.0 trait_handlers/eq/models/field_attribute/FieldAttribute#)) |
| 56 | } |
| 57 | } |