Skip to content

Server::local_addr() cannot be called with executor #1988

@njaard

Description

@njaard

Similar to #1638 but I think the problem is about the executor:

let addr: &str = ...;
let exec = tokio::runtime::current_thread::TaskExecutor::current();
let server = hyper::Server::bind(&addr.parse().expect("parsing address"))
  .executor(exec)
  .serve(new_service);
let _ = server.local_addr();

// no method named `local_addr` found for type    `hyper::server::Server<hyper::server::tcp::AddrIncoming, [[email protected]:206:5: 216:6 main:_], tokio_current_thread::TaskExecutor>` in the current scope

Simply removing the .executor(exec) line solves the problem

I can't tell why local_addr depends on the executor's type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-serverArea: server.E-easyEffort: easy. A task that would be a great starting point for a new contributor.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions