Skip to content
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

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

Closed
njaard opened this issue Oct 21, 2019 · 2 comments
Closed

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

njaard opened this issue Oct 21, 2019 · 2 comments
Labels
A-server Area: server. E-easy Effort: easy. A task that would be a great starting point for a new contributor.

Comments

@njaard
Copy link

njaard commented Oct 21, 2019

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, [closure@main.rs: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.

@seanmonstar
Copy link
Member

Probably the impl<S> Server<AddrStream, S> block needs to add a generic for the executor, like impl<S, E> Server<AddrStream, S, E>...

@seanmonstar seanmonstar added A-server Area: server. E-easy Effort: easy. A task that would be a great starting point for a new contributor. labels Oct 21, 2019
peter-wilkins pushed a commit to peter-wilkins/hyper that referenced this issue Nov 9, 2019
add generic for the executor to server impl block

resolves hyperium#1988
seanmonstar pushed a commit that referenced this issue Nov 12, 2019
…utor (#2009)

add generic for the executor to server impl block

resolves #1988
@seanmonstar
Copy link
Member

Closed by #2029

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-server Area: server. E-easy Effort: easy. A task that would be a great starting point for a new contributor.
Projects
None yet
Development

No branches or pull requests

2 participants