Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

router! macro expansion appears inefficient. #278

Open
pnathan opened this issue Sep 29, 2023 · 0 comments
Open

router! macro expansion appears inefficient. #278

pnathan opened this issue Sep 29, 2023 · 0 comments

Comments

@pnathan
Copy link

pnathan commented Sep 29, 2023

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant