Skip to content

Commit

Permalink
chore(examples): update rossweisse example
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuwn committed Apr 10, 2024
1 parent c94ced2 commit 98b347e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
10 changes: 8 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand All @@ -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" }
22 changes: 12 additions & 10 deletions rossweisse/src/implementations/router/fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down

0 comments on commit 98b347e

Please sign in to comment.