mirror of
https://github.com/fafhrd91/actix-net
synced 2024-11-23 22:51:07 +01:00
fmt with import grouping
This commit is contained in:
parent
855e3f96fe
commit
dc67ba770d
@ -16,10 +16,10 @@ mod bcodec;
|
||||
mod framed;
|
||||
mod lines;
|
||||
|
||||
pub use self::bcodec::BytesCodec;
|
||||
pub use self::framed::{Framed, FramedParts};
|
||||
pub use self::lines::LinesCodec;
|
||||
|
||||
pub use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
|
||||
pub use tokio_util::codec::{Decoder, Encoder};
|
||||
pub use tokio_util::io::poll_read_buf;
|
||||
|
||||
pub use self::bcodec::BytesCodec;
|
||||
pub use self::framed::{Framed, FramedParts};
|
||||
pub use self::lines::LinesCodec;
|
||||
|
@ -1,12 +1,16 @@
|
||||
use std::{
|
||||
collections::VecDeque,
|
||||
io::{self, Write},
|
||||
pin::Pin,
|
||||
task::{
|
||||
Context,
|
||||
Poll::{self, Pending, Ready},
|
||||
},
|
||||
};
|
||||
|
||||
use actix_codec::*;
|
||||
use bytes::Buf;
|
||||
use bytes::{BufMut, BytesMut};
|
||||
use bytes::{Buf as _, BufMut as _, BytesMut};
|
||||
use futures_sink::Sink;
|
||||
use std::collections::VecDeque;
|
||||
use std::io::{self, Write};
|
||||
use std::pin::Pin;
|
||||
use std::task::Poll::{Pending, Ready};
|
||||
use std::task::{Context, Poll};
|
||||
use tokio_test::{assert_ready, task};
|
||||
|
||||
macro_rules! bilateral {
|
||||
|
@ -1,7 +1,9 @@
|
||||
use hyper::service::{make_service_fn, service_fn};
|
||||
use hyper::{Body, Request, Response, Server};
|
||||
use std::convert::Infallible;
|
||||
use std::net::SocketAddr;
|
||||
use std::{convert::Infallible, net::SocketAddr};
|
||||
|
||||
use hyper::{
|
||||
service::{make_service_fn, service_fn},
|
||||
Body, Request, Response, Server,
|
||||
};
|
||||
|
||||
async fn handle(_req: Request<Body>) -> Result<Response<Body>, Infallible> {
|
||||
Ok(Response::new(Body::from("Hello World")))
|
||||
|
@ -51,13 +51,10 @@ compile_error!("io_uring is a linux only feature.");
|
||||
|
||||
use std::future::Future;
|
||||
|
||||
use tokio::task::JoinHandle;
|
||||
|
||||
// Cannot define a main macro when compiled into test harness.
|
||||
// Workaround for https://github.com/rust-lang/rust/issues/62127.
|
||||
#[cfg(all(feature = "macros", not(test)))]
|
||||
pub use actix_macros::main;
|
||||
|
||||
#[cfg(feature = "macros")]
|
||||
pub use actix_macros::test;
|
||||
|
||||
@ -65,12 +62,13 @@ mod arbiter;
|
||||
mod runtime;
|
||||
mod system;
|
||||
|
||||
pub use tokio::pin;
|
||||
use tokio::task::JoinHandle;
|
||||
|
||||
pub use self::arbiter::{Arbiter, ArbiterHandle};
|
||||
pub use self::runtime::Runtime;
|
||||
pub use self::system::{System, SystemRunner};
|
||||
|
||||
pub use tokio::pin;
|
||||
|
||||
pub mod signal {
|
||||
//! Asynchronous signal handling (Tokio re-exports).
|
||||
|
||||
@ -95,7 +93,6 @@ pub mod net {
|
||||
use tokio::io::{AsyncRead, AsyncWrite, Interest};
|
||||
pub use tokio::net::UdpSocket;
|
||||
pub use tokio::net::{TcpListener, TcpSocket, TcpStream};
|
||||
|
||||
#[cfg(unix)]
|
||||
pub use tokio::net::{UnixDatagram, UnixListener, UnixStream};
|
||||
|
||||
|
@ -4,7 +4,6 @@ use std::{
|
||||
};
|
||||
|
||||
use actix_rt::{task::JoinError, Arbiter, System};
|
||||
|
||||
#[cfg(not(feature = "io-uring"))]
|
||||
use {
|
||||
std::{sync::mpsc::channel, thread},
|
||||
|
@ -63,10 +63,10 @@ impl<T> Future for JoinAll<T> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
use actix_utils::future::ready;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn test_join_all() {
|
||||
let futs = vec![ready(Ok(1)), ready(Err(3)), ready(Ok(9))];
|
||||
|
@ -22,10 +22,9 @@ pub use self::builder::ServerBuilder;
|
||||
pub use self::handle::ServerHandle;
|
||||
pub use self::server::Server;
|
||||
pub use self::service::ServerServiceFactory;
|
||||
pub use self::test_server::TestServer;
|
||||
|
||||
#[doc(hidden)]
|
||||
pub use self::socket::FromStream;
|
||||
pub use self::test_server::TestServer;
|
||||
|
||||
/// Start server building process
|
||||
#[doc(hidden)]
|
||||
|
@ -6,7 +6,6 @@ use std::{fmt, io};
|
||||
use actix_rt::net::TcpStream;
|
||||
pub(crate) use mio::net::TcpListener as MioTcpListener;
|
||||
use mio::{event::Source, Interest, Registry, Token};
|
||||
|
||||
#[cfg(unix)]
|
||||
pub(crate) use {
|
||||
mio::net::UnixListener as MioUnixListener,
|
||||
|
@ -394,9 +394,10 @@ mod tests {
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn test_auto_impl_send() {
|
||||
use crate::{map_config, ServiceExt, ServiceFactoryExt};
|
||||
use alloc::rc::Rc;
|
||||
|
||||
use crate::{map_config, ServiceExt, ServiceFactoryExt};
|
||||
|
||||
let srv_1 = fn_service(|_: Rc<u8>| ok::<_, Rc<u8>>(Rc::new(0u8)));
|
||||
|
||||
let fac_1 = fn_factory_with_config(|_: Rc<u8>| {
|
||||
|
@ -38,10 +38,9 @@ pub use self::apply_cfg::{apply_cfg, apply_cfg_factory};
|
||||
pub use self::ext::{ServiceExt, ServiceFactoryExt, TransformExt};
|
||||
pub use self::fn_service::{fn_factory, fn_factory_with_config, fn_service};
|
||||
pub use self::map_config::{map_config, unit_config};
|
||||
pub use self::transform::{apply, ApplyTransform, Transform};
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use self::ready::{err, ok, ready, Ready};
|
||||
pub use self::transform::{apply, ApplyTransform, Transform};
|
||||
|
||||
/// An asynchronous operation from `Request` to a `Response`.
|
||||
///
|
||||
|
@ -15,8 +15,9 @@
|
||||
//! http --verify=false https://127.0.0.1:8443
|
||||
//! ```
|
||||
|
||||
// this use only exists because of how we have organised the crate
|
||||
// it is not necessary for your actual code
|
||||
#[rustfmt::skip]
|
||||
// this `use` is only exists because of how we have organised the crate
|
||||
// it is not necessary for your actual code; you should import from `rustls` directly
|
||||
use tokio_rustls::rustls;
|
||||
|
||||
use std::{
|
||||
|
@ -20,7 +20,6 @@ pub mod reexports {
|
||||
//! Re-exports from `native-tls` and `tokio-native-tls` that are useful for connectors.
|
||||
|
||||
pub use tokio_native_tls::native_tls::TlsConnector;
|
||||
|
||||
pub use tokio_native_tls::TlsStream as AsyncTlsStream;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@ pub mod reexports {
|
||||
pub use openssl::ssl::{
|
||||
Error, HandshakeError, SslConnector, SslConnectorBuilder, SslMethod,
|
||||
};
|
||||
|
||||
pub use tokio_openssl::SslStream as AsyncSslStream;
|
||||
}
|
||||
|
||||
|
@ -26,10 +26,8 @@ use crate::connect::{Connection, Host};
|
||||
pub mod reexports {
|
||||
//! Re-exports from `rustls` and `webpki_roots` that are useful for connectors.
|
||||
|
||||
pub use tokio_rustls::rustls::ClientConfig;
|
||||
|
||||
pub use tokio_rustls::client::TlsStream as AsyncTlsStream;
|
||||
|
||||
pub use tokio_rustls::rustls::ClientConfig;
|
||||
pub use webpki_roots::TLS_SERVER_ROOTS;
|
||||
}
|
||||
|
||||
|
@ -51,13 +51,13 @@ fn openssl_acceptor(cert: String, key: String) -> tls_openssl::ssl::SslAcceptor
|
||||
mod danger {
|
||||
use std::time::SystemTime;
|
||||
|
||||
use super::*;
|
||||
|
||||
use tokio_rustls::rustls::{
|
||||
self,
|
||||
client::{ServerCertVerified, ServerCertVerifier},
|
||||
};
|
||||
|
||||
use super::*;
|
||||
|
||||
pub struct NoCertificateVerification;
|
||||
|
||||
impl ServerCertVerifier for NoCertificateVerification {
|
||||
|
@ -9,11 +9,10 @@ use actix_codec::{BytesCodec, Framed};
|
||||
use actix_rt::net::TcpStream;
|
||||
use actix_server::TestServer;
|
||||
use actix_service::{fn_service, Service, ServiceFactory};
|
||||
use actix_tls::connect::{ConnectError, ConnectInfo, Connection, Connector, Host};
|
||||
use bytes::Bytes;
|
||||
use futures_util::sink::SinkExt;
|
||||
|
||||
use actix_tls::connect::{ConnectError, ConnectInfo, Connection, Connector, Host};
|
||||
|
||||
#[cfg(feature = "openssl")]
|
||||
#[actix_rt::test]
|
||||
async fn test_string() {
|
||||
|
@ -8,11 +8,10 @@ use std::{
|
||||
use actix_rt::net::TcpStream;
|
||||
use actix_server::TestServer;
|
||||
use actix_service::{fn_service, Service, ServiceFactory};
|
||||
use futures_core::future::LocalBoxFuture;
|
||||
|
||||
use actix_tls::connect::{
|
||||
ConnectError, ConnectInfo, Connection, Connector, Host, Resolve, Resolver,
|
||||
};
|
||||
use futures_core::future::LocalBoxFuture;
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn custom_resolver() {
|
||||
|
@ -118,8 +118,6 @@ where
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
use std::sync::{Arc, RwLock};
|
||||
@ -128,6 +126,8 @@ mod test {
|
||||
use slab::Slab;
|
||||
use tracing::{span, Event, Level, Metadata, Subscriber};
|
||||
|
||||
use super::*;
|
||||
|
||||
thread_local! {
|
||||
static SPAN: RefCell<Vec<span::Id>> = RefCell::new(Vec::new());
|
||||
}
|
||||
|
@ -219,11 +219,11 @@ mod serde {
|
||||
|
||||
#[cfg(test)]
|
||||
mod serde_impl_tests {
|
||||
use super::*;
|
||||
|
||||
use serde::de::DeserializeOwned;
|
||||
use static_assertions::assert_impl_all;
|
||||
|
||||
use super::*;
|
||||
|
||||
assert_impl_all!(ByteString: Serialize, DeserializeOwned);
|
||||
}
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
max_width = 96
|
||||
reorder_imports = true
|
||||
group_imports = "StdExternalCrate"
|
||||
|
Loading…
Reference in New Issue
Block a user