I'm getting the following error when I try to pass a SocketAddr type into bind / bind_rustls:
axum_server::bind_rustls(addr)
^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `std::vec::IntoIter`, found struct `std::option::IntoIter`
Details:
I'm trying to implement TLS on my axum server. I have a variable addr of type SocketAddr. I thought I would be able to pass this directly into bind / bind_rustls because it accepts A: ToSocketAddrs and there's an impl ToSocketAddrs for SocketAddr.
I see that impl ToSocketAddrs for String uses std::vec::IntoIter while impl ToSocketAddrs for SocketAddr uses std::option::IntoIter (possibly because it's a single address). I tried forking the repo and changing std::vec::IntoIter to std::iter::Iterable to support both, but seems like that was a bit naive. I get another error "doesn't have a size known at compile-time" because of the BoxedToSocketAddrs type.
For now, I've gotten past it by doing addr.to_string(). Happy to submit a PR if I get some guidance on how to make this work. Thanks!
I'm getting the following error when I try to pass a
SocketAddr
type intobind
/bind_rustls
:Details: I'm trying to implement TLS on my axum server. I have a variable
addr
of typeSocketAddr
. I thought I would be able to pass this directly intobind
/bind_rustls
because it acceptsA: ToSocketAddrs
and there's animpl ToSocketAddrs for SocketAddr
.I see that
impl ToSocketAddrs for String
usesstd::vec::IntoIter
whileimpl ToSocketAddrs for SocketAddr
usesstd::option::IntoIter
(possibly because it's a single address). I tried forking the repo and changingstd::vec::IntoIter
tostd::iter::Iterable
to support both, but seems like that was a bit naive. I get another error "doesn't have a size known at compile-time" because of theBoxedToSocketAddrs
type.For now, I've gotten past it by doing
addr.to_string()
. Happy to submit a PR if I get some guidance on how to make this work. Thanks!