Skip to content

Missing OptionalFromRequestParts implementation for the Host extractor from the axum-extra crate #3170

Open
@dnlsndr

Description

@dnlsndr
  • I have looked for existing issues (including closed) about this

Bug Report

Version

v0.8.1

Platform

UNIX

Crates

axum
axum-extra

Description

Now that the Host extractor was moved to the axum-extra crate and with the new changes to how Option extractors work, it's not possible to do something like this anymore:

use axum_extra::extract::Host;

async fn handler(host: Option<Host>){}

as the compiler complains with this error:

the trait bound `axum_extra::extract::Host: OptionalFromRequestParts<Arc<AppState>>` is not satisfied
you can use `cargo tree` to explore your dependency tree
required for `std::option::Option<axum_extra::extract::Host>` to implement `FromRequestParts<Arc<AppState>>`

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