477: Fix for default monotonic, `monotonics::now()` now properly works r=AfoHT a=korken89



Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
This commit is contained in:
bors[bot] 2021-04-20 17:06:08 +00:00 committed by GitHub
commit 99a53c7ca7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -40,7 +40,7 @@ mod app {
let _: Result<(), ()> = handle.unwrap().cancel();
// Using default
let _: Result<foo::SpawnHandle, ()> = foo::spawn_at(monotonics::MyMono::now());
let _: Result<foo::SpawnHandle, ()> = foo::spawn_at(monotonics::now());
let handle: Result<foo::SpawnHandle, ()> = foo::spawn_after(Seconds(1_u32));
let _: Result<foo::SpawnHandle, ()> = handle.unwrap().reschedule_after(Seconds(1_u32));

View file

@ -119,7 +119,15 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 {
);
let user_imports = &app.user_imports;
let default_monotonic = if monotonic.args.default {
quote!(pub use #name::now;)
} else {
quote!()
};
quote! {
#default_monotonic
#[doc = #doc]
#[allow(non_snake_case)]
pub mod #name {