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

Server trait usability fixes #484

Draft
wants to merge 6 commits into
base: initial-nsec3-generation
Choose a base branch
from

Conversation

ximon18
Copy link
Member

@ximon18 ximon18 commented Jan 28, 2025

I've marked this PR as DRAFT because I need these changes for something I'm testing but I don't actually know if they are needed, or correct, at this point.

  • Remove defaults from trait generic type parameters (i.e. TraitName<TypeParameter = ...>) to prevent intermediate types that impl the trait from not themselves allowing the default type parameter to be overridden.

  • Move common bounds up from implementers of the Service trait to the Service trait itself. This both reduces boilerplate and reduces the chances of a type having stricter bounds on the struct and fns (such as fn new()) than its Service trait impl, making it hard to find the cause of a bounds mismatch.

  • Align bounds on all middleware struct blocks to match the bounds on the Service trait impls to catch mismatched bounds earlier.

  • Remove unnecessary ?Sized bound on impl Service for U where U: Deref.

…TypeParameter = ...>) to prevent intermediate types that impl the trait from not themselves allowing the default type parameter to be overridden.

- Move common bounds up from implementers of the Service trait to the Service trait itself. This both reduces boilerplate and reduces the chances of a type having stricter bounds on the struct and fns (such as fn new()) than its Service trait impl, making it hard to find the cause of a bounds mismatch.

- Align bounds on all middleware struct blocks to match the bounds on the Service trait impls to catch mismatched bounds earlier.

- Remove unnecessary ?Sized bound on impl Service for U where U: Deref.
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.

1 participant