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

feat: allow extractor to receive mutable requests #17

Merged
merged 1 commit into from
Oct 4, 2021

Conversation

DDtKey
Copy link
Owner

@DDtKey DDtKey commented Oct 3, 2021

Description:

These are backward compatible changes to allow the permission extractor to receive mutable ServiceRequest.

Checklist:

  • Tests for the changes have been added (for bug fixes / features);
  • Docs have been added / updated (for bug fixes / features).
  • This PR has been added to CHANGELOG.md (to [Unreleased] section);

Closes #16

type Future: Future<Output = Result<Vec<String>, Error>>;

fn extract(&self, request: &'a ServiceRequest) -> Self::Future;
fn extract(&self, request: &'a mut ServiceRequest) -> Self::Future;
Copy link
Owner Author

@DDtKey DDtKey Oct 3, 2021

Choose a reason for hiding this comment

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

In fact, this trait has lost backward compatibility.
But all its implementations support both versions (mut / non-mut ref).

So, it should be invisible to the end user.
However there are concerns that there might be users with custom implementation of this trait

I have one more idea to save full compatible 🤔
I'll try it a bit later

@DDtKey DDtKey merged commit b032b5b into main Oct 4, 2021
@DDtKey DDtKey added the feature label Oct 4, 2021
@DDtKey DDtKey deleted the extractor-mut-request branch November 10, 2021 07:45
DDtKey added a commit that referenced this pull request Jan 8, 2022
* Support custom types for permissions/roles [#25]
* How to use section to readme [#18]
* Allow extractor to receive mutable requests [#17]
DDtKey added a commit that referenced this pull request Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature
Projects
None yet
1 participant