Skip to content

router! macro expansion appears inefficient. #278

@pnathan

Description

@pnathan

router! macro expansion appears inefficient.

Hi, when I do an expand of router!, I see a number of outputs that look like this.
Shouldn't this be, ultimately, a string compare?

    {
        if ret.is_none() && request.method() == stringify!( POST ) {
            ret = {
                let required = concat!( "/", stringify!( api ) );
                if let Some(rest_url) = request_url.strip_prefix(required) {
                    {
                        let required = concat!( "/", stringify!( v1 ) );
                        if let Some(rest_url) = rest_url.strip_prefix(required) {
                            {
                                let required = concat!( "/", stringify!( domain ) );
                                if let Some(rest_url) = rest_url.strip_prefix(required) {
                                

I'm more than happy to use an interface that looks like

server.add_handler("/api/v1/domain", method::POST, domain_handler_post)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions