docs(server): set doc_cfg attributes for tcp feature gated Server methods (#2401)

This commit is contained in:
nickelc
2021-01-14 22:56:49 +01:00
committed by GitHub
parent f0ddb66932
commit 257d6a9919

View File

@@ -52,8 +52,10 @@ impl<I> Server<I, ()> {
} }
} }
#[cfg(feature = "tcp")] cfg_feature! {
impl Server<AddrIncoming, ()> { #![all(feature = "tcp")]
impl Server<AddrIncoming, ()> {
/// Binds to the provided address, and returns a [`Builder`](Builder). /// Binds to the provided address, and returns a [`Builder`](Builder).
/// ///
/// # Panics /// # Panics
@@ -76,14 +78,18 @@ impl Server<AddrIncoming, ()> {
pub fn from_tcp(listener: StdTcpListener) -> Result<Builder<AddrIncoming>, crate::Error> { pub fn from_tcp(listener: StdTcpListener) -> Result<Builder<AddrIncoming>, crate::Error> {
AddrIncoming::from_std(listener).map(Server::builder) AddrIncoming::from_std(listener).map(Server::builder)
} }
}
} }
#[cfg(feature = "tcp")] cfg_feature! {
impl<S, E> Server<AddrIncoming, S, E> { #![all(feature = "tcp")]
impl<S, E> Server<AddrIncoming, S, E> {
/// Returns the local address that this server is bound to. /// Returns the local address that this server is bound to.
pub fn local_addr(&self) -> SocketAddr { pub fn local_addr(&self) -> SocketAddr {
self.spawn_all.local_addr() self.spawn_all.local_addr()
} }
}
} }
impl<I, IO, IE, S, E, B> Server<I, S, E> impl<I, IO, IE, S, E, B> Server<I, S, E>