Skip to content

Commit

Permalink
use id arg for via settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Univa committed Apr 11, 2024
1 parent d340eb9 commit 3582267
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions rumcake-macros/src/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,33 +399,35 @@ pub(crate) fn keyboard_main(
);
error = true;
} else if let Some(args) = keyboard.via {
let id = args.id;
if args.use_storage.map_or(false, |b| *b) && keyboard.storage.is_none() {
emit_error!(args.use_storage.unwrap().span(), "Via uses storage but no `storage` driver was specified. Either specify a `storage` driver, or remove `use_storage` from your Via settings.");
error = true;
} else if args.use_storage.map_or(false, |b| *b) {
spawning.extend(quote! {
::rumcake::via::initialize_via_data(#kb_name).await;
::rumcake::via::initialize_via_data(#id).await;
});
}

spawning.extend(quote! {
spawner
.spawn(::rumcake::via_process_task!(#kb_name))
.spawn(::rumcake::via_process_task!(#id))
.unwrap();
});
} else if let Some(args) = keyboard.vial {
let id = args.id;
if args.use_storage.map_or(false, |b| *b) && keyboard.storage.is_none() {
emit_error!(args.use_storage.unwrap().span(), "Vial uses storage but no `storage` driver was specified. Either specify a `storage` driver, or remove `use_storage` from your Vial settings.");
error = true;
} else if args.use_storage.map_or(false, |b| *b) {
spawning.extend(quote! {
::rumcake::vial::initialize_vial_data(#kb_name).await;
::rumcake::vial::initialize_vial_data(#id).await;
});
}

spawning.extend(quote! {
spawner
.spawn(::rumcake::vial_process_task!(#kb_name))
.spawn(::rumcake::vial_process_task!(#id))
.unwrap();
});
}
Expand Down

0 comments on commit 3582267

Please sign in to comment.