Debian Codegraph @

src/trait_handlers/debug/common.rs

raw symbols SCIP
1 use quoterust-analyzer cargo quote 1.0.47 crate/::quoterust-analyzer cargo quote 1.0.47 quote!;
2 use synrust-analyzer cargo syn 2.0.119 crate/::{DeriveInputrust-analyzer cargo syn 2.0.119 derive/DeriveInput#, Pathrust-analyzer cargo syn 2.0.119 path/Path#, Typerust-analyzer cargo syn 2.0.119 ty/Type#};
3
4 #[inline]
5 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn create_debug_map_builderrust-analyzer cargo educe 0.6.0 trait_handlers/debug/common/create_debug_map_builder().() -> proc_macro2rust-analyzer cargo proc-macro2 1.0.107 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.107 TokenStream# {
6 quoterust-analyzer cargo quote 1.0.47 quote!!(
7 #[allow(non_camel_case_types)] // We're using __ to help avoid clashes.
8 struct Educe__RawString(&'static str);
9
10 impl ::core::fmt::Debug for Educe__RawString {
11 #[inline]
12 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
13 f.write_str(self.0)
14 }
15 }
16
17 let mut builder = f.debug_map();
18 )
19 }
20
21 #[inline]
22 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn create_format_argrust-analyzer cargo educe 0.6.0 trait_handlers/debug/common/create_format_arg().(
23 ast: &DeriveInputrust-analyzer cargo syn 2.0.119 derive/DeriveInput#,
24 field_ty: &Typerust-analyzer cargo syn 2.0.119 ty/Type#,
25 format_method: &Pathrust-analyzer cargo syn 2.0.119 path/Path#,
26 field_expr: proc_macro2rust-analyzer cargo proc-macro2 1.0.107 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.107 TokenStream#,
27 ) -> proc_macro2rust-analyzer cargo proc-macro2 1.0.107 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.107 TokenStream# {
28 let ty_ident = &ast.identrust-analyzer cargo syn 2.0.119 derive/DeriveInput#ident.;
29
30 // We use the complete original generics, not filtered by field,
31 // and include a PhantomData<Self> in our wrapper struct to use the generics.
32 //
33 // This avoids having to try to calculate the right *subset* of the generics
34 // relevant for this field, which is nontrivial and maybe impossible.
35 let (impl_generics, ty_generics, where_clause) = ast.genericsrust-analyzer cargo syn 2.0.119 derive/DeriveInput#generics..split_for_implrust-analyzer cargo syn 2.0.119 generics/impl#[Generics]split_for_impl().();
36
37 quoterust-analyzer cargo quote 1.0.47 quote!!(
38 let arg = {
39 #[allow(non_camel_case_types)] // We're using __ to help avoid clashes.
40 struct Educe__DebugField<V, M>(V, ::core::marker::PhantomData<M>);
41
42 impl #impl_generics ::core::fmt::Debug
43 for Educe__DebugField<&#field_ty, #ty_ident #ty_generics>
44 #where_clause
45 {
46 #[inline]
47 fn fmt(&self, educe__f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
48 #format_method(self.0, educe__f)
49 }
50 }
51
52 Educe__DebugField(#field_expr, ::core::marker::PhantomData::<Self>)
53 };
54 )
55 }