docs and tests work

This commit is contained in:
Christien Rioux
2023-08-29 15:15:47 -05:00
parent d3407998f5
commit e302b764d0
27 changed files with 156 additions and 74 deletions

View File

@@ -16,6 +16,7 @@ mod stats;
mod tasks;
mod types;
#[doc(hidden)]
pub mod tests;
////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -264,6 +264,8 @@ impl Network {
} else if #[cfg(feature="rt-tokio")] {
std_listener.set_nonblocking(true).expect("failed to set nonblocking");
let listener = TcpListener::from_std(std_listener).wrap_err("failed to create tokio tcp listener")?;
} else {
compile_error!("needs executor implementation")
}
}
@@ -291,6 +293,8 @@ impl Network {
let incoming_stream = listener.incoming();
} else if #[cfg(feature="rt-tokio")] {
let incoming_stream = tokio_stream::wrappers::TcpListenerStream::new(listener);
} else {
compile_error!("needs executor implementation")
}
}

View File

@@ -136,6 +136,8 @@ impl Network {
} else if #[cfg(feature="rt-tokio")] {
std_udp_socket.set_nonblocking(true).expect("failed to set nonblocking");
let udp_socket = UdpSocket::from_std(std_udp_socket).wrap_err("failed to make outbound v4 tokio udpsocket")?;
} else {
compile_error!("needs executor implementation")
}
}
let socket_arc = Arc::new(udp_socket);
@@ -160,6 +162,8 @@ impl Network {
} else if #[cfg(feature="rt-tokio")] {
std_udp_socket.set_nonblocking(true).expect("failed to set nonblocking");
let udp_socket = UdpSocket::from_std(std_udp_socket).wrap_err("failed to make outbound v6 tokio udpsocket")?;
} else {
compile_error!("needs executor implementation")
}
}
let socket_arc = Arc::new(udp_socket);
@@ -190,6 +194,8 @@ impl Network {
} else if #[cfg(feature="rt-tokio")] {
std_udp_socket.set_nonblocking(true).expect("failed to set nonblocking");
let udp_socket = UdpSocket::from_std(std_udp_socket).wrap_err("failed to make inbound tokio udpsocket")?;
} else {
compile_error!("needs executor implementation")
}
}
let socket_arc = Arc::new(udp_socket);

View File

@@ -8,6 +8,8 @@ cfg_if! {
} else if #[cfg(feature="rt-tokio")] {
pub use tokio::net::{TcpStream, TcpListener, UdpSocket};
pub use tokio_util::compat::*;
} else {
compile_error!("needs executor implementation")
}
}
@@ -224,6 +226,8 @@ pub async fn nonblocking_connect(
Ok(TimeoutOr::value(TcpStream::from(async_stream.into_inner()?)))
} else if #[cfg(feature="rt-tokio")] {
Ok(TimeoutOr::value(TcpStream::from_std(async_stream.into_inner()?)?))
} else {
compile_error!("needs executor implementation")
}
}
}

View File

@@ -36,7 +36,9 @@ impl RawTcpNetworkConnection {
// self.tcp_stream.get_mut()
// .shutdown()
// .await
// }
// } else {
// compile_error!("needs executor implementation")
// }
// }
// }

View File

@@ -14,6 +14,8 @@ cfg_if! {
pub type WebsocketNetworkConnectionWSS =
WebsocketNetworkConnection<async_tls::client::TlsStream<Compat<TcpStream>>>;
pub type WebsocketNetworkConnectionWS = WebsocketNetworkConnection<Compat<TcpStream>>;
} else {
compile_error!("needs executor implementation")
}
}