At the time of writing this issue we still auto-wrap State
used in Context
automatically in an Arc
.
There was good reason for it: as we expect context to be cloned in some fan services (e.g. tcp listener and http server),
as well as some middleware (e.g. retry middleware).
A user of rama
has raised on Discord however a use case where State
, given it is only used by 1 service at a time,
could be mutated and it would help their use case. RIght now that is only possible by putting such mutatable state as an Extension
or by having a question Request
, neither are very desirable for required custom state that you know is there and need to mutate. A non-considered option would be to use interior mutability but that would be a performance penalty with no real benefit.
As such not wrapping the state in Arc
is probably the solution. For data that is heavy to clone and that is to be considered read-only, the users can still wrap those parts themselves as an Arc
. Or even wrap the entire state in Arc
, but it would be their choice.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too