Skip to content

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 functions (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.

@ximon18 ximon18 changed the base branch from initial-nsec3-generation to main May 30, 2025 21:25
@ximon18 ximon18 changed the base branch from main to initial-nsec3-generation May 30, 2025 21:26
…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.
@ximon18 ximon18 force-pushed the server-trait-usability-fixes branch from 3d13a1d to 35a17a1 Compare May 30, 2025 22:38
@ximon18 ximon18 changed the base branch from initial-nsec3-generation to main May 30, 2025 22:39
@tertsdiepraam
Copy link
Contributor

@ximon18 do you feel this is ready now? (Apart from the conflicts.)

@ximon18
Copy link
Member Author

ximon18 commented Oct 30, 2025

These changes are IIRC in the patches-for-nameshed-prototype branch and so were needed by Cascade.

Whether Cascade would work without them now would need testing.

I think ultimately this will all be replaced by the new-xxx work.

@ximon18 ximon18 marked this pull request as ready for review November 20, 2025 14:40
@ximon18 ximon18 added breaking A PR that includes a breaking change. unstable feature labels Nov 21, 2025
@ximon18 ximon18 merged commit e2f3d64 into main Nov 21, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking A PR that includes a breaking change. unstable feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants