Reduce dependency on futures-util (#3358)

This commit is contained in:
Paolo Barbolini
2025-05-25 09:39:35 +02:00
committed by GitHub
parent d0aff24c85
commit 869ba86e51
32 changed files with 50 additions and 67 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ publish = false
[dependencies]
axum = { path = "../../axum", features = ["multipart"] }
futures = "0.3"
futures-util = { version = "0.3", default-features = false, features = ["sink", "std"] }
tokio = { version = "1.0", features = ["full"] }
tokio-util = { version = "0.7", features = ["io"] }
tracing = "0.1"
+3 -4
View File
@@ -12,8 +12,8 @@ use axum::{
routing::{get, post},
BoxError, Router,
};
use futures::{Stream, TryStreamExt};
use std::io;
use futures_util::{Stream, TryStreamExt};
use std::{io, pin::pin};
use tokio::{fs::File, io::BufWriter};
use tokio_util::io::StreamReader;
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
@@ -112,8 +112,7 @@ where
async {
// Convert the stream into an `AsyncRead`.
let body_with_io_error = stream.map_err(io::Error::other);
let body_reader = StreamReader::new(body_with_io_error);
futures::pin_mut!(body_reader);
let mut body_reader = pin!(StreamReader::new(body_with_io_error));
// Create the file. `File` implements `AsyncWrite`.
let path = std::path::Path::new(UPLOADS_DIRECTORY).join(path);