From 98b347ef5182733ed664c541d1322fd316a47365 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Wed, 10 Apr 2024 02:32:15 -0700 Subject: [PATCH] chore(examples): update rossweisse example --- Cargo.toml | 10 +++++++-- .../src/implementations/router/fields.rs | 22 ++++++++++--------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 02d518f..241ac7b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,13 @@ tokio-openssl = { version = "0.6.3", optional = true } async-std-openssl = { version = "0.6.3", optional = true } # Non-blocking I/O -tokio = { version = "1.26.0", default-features = false, features = ["rt-multi-thread", "sync", "net", "io-util", "macros"], optional = true } +tokio = { version = "1.26.0", default-features = false, features = [ + "rt-multi-thread", + "sync", + "net", + "io-util", + "macros", +], optional = true } async-trait = "0.1.68" async-std = { version = "1.12.0", features = ["attributes"], optional = true } @@ -50,4 +56,4 @@ tree_magic = { version = "0.2.3", optional = true } # MIME paste = "1.0.12" # Token Pasting [dev-dependencies] -rossweisse = { version = "0.0.2", path = "./rossweisse" } +rossweisse = { version = "0.0.3", path = "./rossweisse" } diff --git a/rossweisse/src/implementations/router/fields.rs b/rossweisse/src/implementations/router/fields.rs index 1280270..6d09ab4 100644 --- a/rossweisse/src/implementations/router/fields.rs +++ b/rossweisse/src/implementations/router/fields.rs @@ -25,17 +25,19 @@ pub fn fields(arguments: TokenStream, item: syn::ItemStruct) -> TokenStream { let router_identifier = item.ident; let (named_fields, has_fields) = match item.fields { syn::Fields::Named(fields) => (fields, true), - syn::Fields::Unit => ( - syn::FieldsNamed { - brace_token: syn::token::Brace::default(), - named: Default::default(), - }, - false, - ), - _ => panic!( - "`#[rossweisse::router]` can only be used on `struct`s with named \ + syn::Fields::Unit => + ( + syn::FieldsNamed { + brace_token: syn::token::Brace::default(), + named: Default::default(), + }, + false, + ), + _ => + panic!( + "`#[rossweisse::router]` can only be used on `struct`s with named \ fields or unit structs" - ), + ), }; let mut default_expressions = vec![]; let new_method_fields = named_fields.named.iter().map(|field| {