Skip to content

why is there a restriction of fn main() on #[async_std::main]?Β #17

Closed
@shakyShane

Description

@shakyShane

More of a question really as this was surprising to me.

When using Tokio, you can add #[tokio::main] to any fn and it works as expected, expanding out to eventually calling block_on on a runtime.

I can see https://github.com/async-rs/async-attributes/blob/master/src/lib.rs#L59 and wondered why this restriction is in place? if there's no technical limitation I will happily send a PR πŸ‘

Also whilst here, I noticed that since you expect the attribute to always exist on main, your code doesn't account for visibilty modifiers, eg: pub fn main() would lose the pub

again, if it's just yet to be built then I'd love to help out.

Many thanks for your time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions