Skip to content

Consider moving State off of Request #643

Open
@Fishrock123

Description

@Fishrock123

It would be nice to not have Request have a generic parameter, for e.g. the AsyncRead trait which requires pinning. See #642 (comment) for where this was originally encountered.

However in interest of keeping middleware simple it would still be nice to allow (Request, Next) -> Fut<Result<>>, but for State it would probably ideal to have an extra parameter, kinda like Surf's Client, e.g. (Request, State, Next) -> Fut<Result<>>.

I was thinking maybe server.middleware() / endpoints could take impl Into<Middleware<State>> / endpoint, and so then that trait could be applied to both of the above with an extra function wrapper for the simple case, allowing both to work, and scoping State to the middleware/endpoint stack.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions