struct_scheme

Crates.iostruct_scheme
lib.rsstruct_scheme
version0.0.3
sourcesrc
created_at2024-02-26 11:58:01.60278
updated_at2024-02-26 14:42:49.04142
descriptionstructure scheme display
homepage
repositoryhttps://github.com/NodusLorden/struct_scheme
max_upload_size
id1153474
size12,676
(NodusLorden)

documentation

README

struct_scheme

Library for displaying the structure token scheme for macros debug

Example

use struct_scheme::StructScheme;
use struct_scheme::TraitStructScheme;


#[derive(StructScheme)]
struct Car {
    id: i32,
    name: String
}
println!("{}", Car::get_scheme());

You can see:

DeriveInput {
   attrs: [],
   vis: Visibility::Inherited,
   ident: Ident {
       ident: "A",
       span: #0 bytes(469..470),
   },
   generics: Generics {
       lt_token: None,
       params: [],
       gt_token: None,
       where_clause: None,
   },
   data: Data::Struct {
       struct_token: Struct,
       fields: Fields::Named {
           brace_token: Brace,
           named: [
               Field {
                   attrs: [],
                   vis: Visibility::Inherited,
                   mutability: FieldMutability::
                   ident: Some(
                       Ident {
                           ident: "number",
                           span: #0 bytes(481..4
                       },
                   ),
                   colon_token: Some(
                       Colon,
                   ),
                   ty: Type::Path {
                       qself: None,
                       path: Path {
                           leading_colon: None,
                           segments: [
                               PathSegment {
                                   ident: Ident 
                                       ident: "i
                                       span: #0 
                                   },
                                   arguments: Pa
                               },
                           ],
                       },
                   },
               },
               Comma,
               Field {
                   attrs: [],
                   vis: Visibility::Inherited,
                   mutability: FieldMutability::
                   ident: Some(
                       Ident {
                           ident: "text",
                           span: #0 bytes(502..5
                       },
                   ),
                   colon_token: Some(
                       Colon,
                   ),
                   ty: Type::Path {
                       qself: None,
                       path: Path {
                           leading_colon: None,
                           segments: [
                               PathSegment {
                                   ident: Ident 
                                       ident: "S
                                       span: #0 
                                   },
                                   arguments: Pa
                               },
                           ],
                       },
                   },
               },
               Comma,
           ],
       },
       semi_token: None,
   },
Commit count: 0

cargo fmt