-
Notifications
You must be signed in to change notification settings - Fork 321
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
Work toward cross-framework middleware interface #164
Comments
If folks want to help on this front, one great step would be to start documenting the various middleware interfaces defined by frameworks today -- Actix, Gotham, Rocket, Tower-Web, Tide. For now, maybe just drop copies of the relevant traits and traits as comments here on this thread. |
Actix's middleware P.s. personally I think there is no value in trying to work out Middleware since it almost impossible without all other components being shared |
Gotham middleware relies on two traits: It isn't terribly complex, but I have questions surrounding how to best wrap |
Sylvain Kerkour has an interesting examination of what the interfaces look like for different exercises, Tide isn't considered but how the exercises look in tide would be interesting (note to self): https://kerkour.com/rust-web-framework-2022 The "Inventing the Service trait" post shows how Tower's fundamental Service trait could be designed from scratch. @aturon as requested, they end up with something like this (full detail is more involved: pub trait Service<Request> {
type Response;
type Error;
type Future: Future<Output = Result<Self::Response, Self::Error>>;
fn poll_ready(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>;
fn call(&mut self, req: Request) -> Self::Future;
} |
Originally posted by @rolftimmermans in #162 (comment)
Having a universal middleware concept in the Rust web-ecosystem is something I look forward to. In the Ruby community, for example, every framework builds on Rack middleware. I see this as the sole factor that allows for (some) code reuse across frameworks.
My questions would be:
The text was updated successfully, but these errors were encountered: