mirror of https://github.com/rwf2/Rocket.git
Rename 'candidate_endpoint()', 'bind_endpoint()'.
This commit is contained in:
parent
19dd627a7c
commit
8f3061ba40
|
@ -11,7 +11,7 @@ pub trait Bindable: Sized {
|
||||||
async fn bind(self) -> Result<Self::Listener, Self::Error>;
|
async fn bind(self) -> Result<Self::Listener, Self::Error>;
|
||||||
|
|
||||||
/// The endpoint that `self` binds on.
|
/// The endpoint that `self` binds on.
|
||||||
fn candidate_endpoint(&self) -> io::Result<Endpoint>;
|
fn bind_endpoint(&self) -> io::Result<Endpoint>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<L: Listener + 'static> Bindable for L {
|
impl<L: Listener + 'static> Bindable for L {
|
||||||
|
@ -23,7 +23,7 @@ impl<L: Listener + 'static> Bindable for L {
|
||||||
Ok(self)
|
Ok(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn candidate_endpoint(&self) -> io::Result<Endpoint> {
|
fn bind_endpoint(&self) -> io::Result<Endpoint> {
|
||||||
L::endpoint(self)
|
L::endpoint(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ impl<A: Bindable, B: Bindable> Bindable for either::Either<A, B> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn candidate_endpoint(&self) -> io::Result<Endpoint> {
|
fn bind_endpoint(&self) -> io::Result<Endpoint> {
|
||||||
either::for_both!(self, a => a.candidate_endpoint())
|
either::for_both!(self, a => a.bind_endpoint())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ impl Bindable for std::net::SocketAddr {
|
||||||
TcpListener::bind(self).await
|
TcpListener::bind(self).await
|
||||||
}
|
}
|
||||||
|
|
||||||
fn candidate_endpoint(&self) -> io::Result<Endpoint> {
|
fn bind_endpoint(&self) -> io::Result<Endpoint> {
|
||||||
Ok(Endpoint::Tcp(*self))
|
Ok(Endpoint::Tcp(*self))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,8 +85,8 @@ impl<I: Bindable> Bindable for TlsBindable<I>
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn candidate_endpoint(&self) -> io::Result<Endpoint> {
|
fn bind_endpoint(&self) -> io::Result<Endpoint> {
|
||||||
let inner = self.inner.candidate_endpoint()?;
|
let inner = self.inner.bind_endpoint()?;
|
||||||
Ok(inner.with_tls(&self.tls))
|
Ok(inner.with_tls(&self.tls))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ impl Bindable for UdsConfig {
|
||||||
Ok(UdsListener { lock, listener, path: self.path, })
|
Ok(UdsListener { lock, listener, path: self.path, })
|
||||||
}
|
}
|
||||||
|
|
||||||
fn candidate_endpoint(&self) -> io::Result<Endpoint> {
|
fn bind_endpoint(&self) -> io::Result<Endpoint> {
|
||||||
Ok(Endpoint::Unix(self.path.clone()))
|
Ok(Endpoint::Unix(self.path.clone()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ impl Rocket<Ignite> {
|
||||||
<B::Listener as Listener>::Connection: AsyncRead + AsyncWrite,
|
<B::Listener as Listener>::Connection: AsyncRead + AsyncWrite,
|
||||||
R: Future<Output = Result<Arc<Rocket<Orbit>>>>
|
R: Future<Output = Result<Arc<Rocket<Orbit>>>>
|
||||||
{
|
{
|
||||||
let binding_endpoint = bindable.candidate_endpoint().ok();
|
let binding_endpoint = bindable.bind_endpoint().ok();
|
||||||
let h12listener = bindable.bind()
|
let h12listener = bindable.bind()
|
||||||
.map_err(|e| ErrorKind::Bind(binding_endpoint, Box::new(e)))
|
.map_err(|e| ErrorKind::Bind(binding_endpoint, Box::new(e)))
|
||||||
.await?;
|
.await?;
|
||||||
|
|
Loading…
Reference in New Issue