roadster-rs / roadster

"Batteries Included" web framework for Rust designed to get you moving fast 🏎️
Apache License 2.0
4 stars 0 forks source link

Should App methods take self? #272

Closed spencewenski closed 2 weeks ago

spencewenski commented 2 months ago

It may be useful for consumers to be able to put state on their App implementation that they can use in the app trait.

This could also be a transition step towards a builder-style approach to building the app, where we provide a default app impl, but still allow consumers to directly use the trait impl if they want.

spencewenski commented 2 months ago

This would be a breaking change

spencewenski commented 2 weeks ago

Do we want methods to also take an owned context/state? This could future proof the methods.

spencewenski commented 2 weeks ago

Do we want methods to also take an owned context/state? This could future proof the methods.

Not right now at least. I think this would potentially give the incorrect perception that the state could be modified. That won't work by default unless the consumer implements an internal-mutability pattern.