Skip to content

Conversation

@jplatte
Copy link
Member

@jplatte jplatte commented Apr 23, 2025

This allows sharing state if the request and response types don't have a mechanism for that like https request extensions. It's also slightly more type-safe way than request extensions¹.

This could certainly use some more docs, though I'm really not good at writing docs. Maybe just an example would be sufficient?

Also if you want I can add this to ServiceBuilder as well. I don't know how well in sync ServiceBuilder and ServiceExt are right now, and personally I would probably use the Layer directly but definitely never ServiceBuilder 🤷🏼

¹ can't accidentally have code adding Arc<Foo> as an extension, and some other code that tries to access just Foo; can still try to access state that's not available (due to the layer being applied in the wrong place / conditionally / not at all)

@jplatte jplatte marked this pull request as ready for review April 23, 2025 20:27
… and make it pass in a stupid way.
@jplatte jplatte marked this pull request as draft April 23, 2025 20:47
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