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

#[any] macro #3310

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

#[any] macro #3310

wants to merge 1 commit into from

Conversation

sabinonweb
Copy link

PR Type

It's a draft PR for progress checking DRAFT PR

PR_TYPE

PR Checklist

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made for the appropriate packages.
  • Format code with the latest stable rustfmt.
  • (Team) Label with affected crates and semver status.

Overview

@robjtede robjtede marked this pull request as draft March 16, 2024 11:10
@@ -196,6 +196,7 @@ method_macro!(Connect, connect);
method_macro!(Options, options);
method_macro!(Trace, trace);
method_macro!(Patch, patch);
method_macro!(All, all);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will almost certainly be easier with a new macro creator rather than trying to retro-fit method_macro!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is making a custom http server and defining any a way or is there a better way? @robjtede

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What it would need to generate would be similar to the other macros (an HttpServiceFactory implementation) except without adding any method guards to the route.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am sorry but I am not sure if I understand @robjtede

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2024-03-17 123942
Do I need to define it here?
Screenshot 2024-03-17 124134
Or in service.rs in actix-http.
Pardon me for asking so many questions btw

Comment on lines +6 to +9
#[route("/single", method = "ALL")]
async fn index() -> String {
"Hello Single!".to_owned()
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we were trying to aim more so for the dedicated macro style:

#[any("/path")]
async handler() {
  // ...

@robjtede robjtede changed the title Update: Draft #[any] macro Mar 16, 2024
@robjtede robjtede linked an issue Mar 16, 2024 that may be closed by this pull request
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

Successfully merging this pull request may close these issues.

Add macro for route handler accepting all HTTP methods
2 participants