From 8f3061ba407cbb6e8db0346a15f4e49578d8f08b Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Wed, 20 Mar 2024 14:29:32 -0700 Subject: [PATCH] Rename 'candidate_endpoint()', 'bind_endpoint()'. --- core/lib/src/listener/bindable.rs | 8 ++++---- core/lib/src/listener/tcp.rs | 2 +- core/lib/src/listener/tls.rs | 4 ++-- core/lib/src/listener/unix.rs | 2 +- core/lib/src/server.rs | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/lib/src/listener/bindable.rs b/core/lib/src/listener/bindable.rs index 62eb9e7b..09cd78f2 100644 --- a/core/lib/src/listener/bindable.rs +++ b/core/lib/src/listener/bindable.rs @@ -11,7 +11,7 @@ pub trait Bindable: Sized { async fn bind(self) -> Result; /// The endpoint that `self` binds on. - fn candidate_endpoint(&self) -> io::Result; + fn bind_endpoint(&self) -> io::Result; } impl Bindable for L { @@ -23,7 +23,7 @@ impl Bindable for L { Ok(self) } - fn candidate_endpoint(&self) -> io::Result { + fn bind_endpoint(&self) -> io::Result { L::endpoint(self) } } @@ -46,7 +46,7 @@ impl Bindable for either::Either { } } - fn candidate_endpoint(&self) -> io::Result { - either::for_both!(self, a => a.candidate_endpoint()) + fn bind_endpoint(&self) -> io::Result { + either::for_both!(self, a => a.bind_endpoint()) } } diff --git a/core/lib/src/listener/tcp.rs b/core/lib/src/listener/tcp.rs index 32b7e165..af54ff7d 100644 --- a/core/lib/src/listener/tcp.rs +++ b/core/lib/src/listener/tcp.rs @@ -14,7 +14,7 @@ impl Bindable for std::net::SocketAddr { TcpListener::bind(self).await } - fn candidate_endpoint(&self) -> io::Result { + fn bind_endpoint(&self) -> io::Result { Ok(Endpoint::Tcp(*self)) } } diff --git a/core/lib/src/listener/tls.rs b/core/lib/src/listener/tls.rs index ceaaa375..7ff631f7 100644 --- a/core/lib/src/listener/tls.rs +++ b/core/lib/src/listener/tls.rs @@ -85,8 +85,8 @@ impl Bindable for TlsBindable }) } - fn candidate_endpoint(&self) -> io::Result { - let inner = self.inner.candidate_endpoint()?; + fn bind_endpoint(&self) -> io::Result { + let inner = self.inner.bind_endpoint()?; Ok(inner.with_tls(&self.tls)) } } diff --git a/core/lib/src/listener/unix.rs b/core/lib/src/listener/unix.rs index b29fc71d..a6db1801 100644 --- a/core/lib/src/listener/unix.rs +++ b/core/lib/src/listener/unix.rs @@ -69,7 +69,7 @@ impl Bindable for UdsConfig { Ok(UdsListener { lock, listener, path: self.path, }) } - fn candidate_endpoint(&self) -> io::Result { + fn bind_endpoint(&self) -> io::Result { Ok(Endpoint::Unix(self.path.clone())) } } diff --git a/core/lib/src/server.rs b/core/lib/src/server.rs index bb70f5eb..ff317917 100644 --- a/core/lib/src/server.rs +++ b/core/lib/src/server.rs @@ -111,7 +111,7 @@ impl Rocket { ::Connection: AsyncRead + AsyncWrite, R: Future>>> { - let binding_endpoint = bindable.candidate_endpoint().ok(); + let binding_endpoint = bindable.bind_endpoint().ok(); let h12listener = bindable.bind() .map_err(|e| ErrorKind::Bind(binding_endpoint, Box::new(e))) .await?;