Wrong version for monoio-macro on Crates.io [monoio] - TagMerge

Wrong version for monoio-macro on Crates.io

KernelErrAsked 5 months ago

Version

monoio = "0.0.3"

Description

The following code failed to compile:

#[monoio::main(worker_threads = 2)]
async fn main() {
   println!("123");
}

with error: error: Unknown attribute worker_threads is specified; expected one of: worker_threads, entries, timer_enabled

Monoio-macro on Crates.io: https://docs.rs/monoio-macros/0.0.2/src/monoio_macros/entry.rs.html#110

match ident.as_str() {
                    "entries" => {
                        config.set_entries(
                            namevalue.lit.clone(),
                            syn::spanned::Spanned::span(&namevalue.lit),
                        )?;
                    }
                    "timer_enabled" | "timer" => config.set_timer_enabled(
                        namevalue.lit.clone(),
                        syn::spanned::Spanned::span(&namevalue.lit),
                    )?,
                    name => {
                        let msg = format!(
                            "Unknown attribute {} is specified; expected one of: `worker_threads`, `entries`, `timer_enabled`",
                            name,
                        );
                        return Err(syn::Error::new_spanned(namevalue, msg));
                    }
                }

On GitHub:

match ident.as_str() {
                    "entries" => config.set_entries(
                        namevalue.lit.clone(),
                        syn::spanned::Spanned::span(&namevalue.lit),
                    )?,
                    "timer_enabled" | "enable_timer" | "timer" => config.set_timer_enabled(
                        namevalue.lit.clone(),
                        syn::spanned::Spanned::span(&namevalue.lit),
                    )?,
                    "worker_threads" | "workers" | "threads" => config.set_threads(
                        namevalue.lit.clone(),
                        syn::spanned::Spanned::span(&namevalue.lit),
                    )?,
                    name => {
                        let msg = format!(
                            "Unknown attribute {} is specified; expected one of: `worker_threads`, `entries`, `timer_enabled`",
                            name,
                        );
                        return Err(syn::Error::new_spanned(namevalue, msg));
                    }
                }

Does code on Crates.io have missed something?

Source: link

ihciahAnswered 5 months ago

We merged a new PR(#7 ) about macro yesterday, and it has not been published yet.

You can use #[monoio::main] to only use one thread. Or you can clone the repo, and run example directly to use the latest code.

KernelErrAnswered 5 months ago

Thanks, I'll wait for the next version of monoio-macros.

Recent Issues

    Programming Languages