Skip to content

Commit

Permalink
Simplify code example by extracting file variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 committed Dec 26, 2024
1 parent c3481f5 commit 9429e59
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions axum-extra/src/response/file_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ use tokio_util::io::ReaderStream;
/// use tokio_util::io::ReaderStream;
///
/// async fn file_stream() -> Result<Response, (StatusCode, String)> {
/// let stream = ReaderStream::new(
/// File::open("test.txt")
/// .await
/// .map_err(|e| (StatusCode::NOT_FOUND, format!("File not found: {e}")))?,
/// );
/// let file = File::open("test.txt")
/// .await
/// .map_err(|e| (StatusCode::NOT_FOUND, format!("File not found: {e}")))?;
///
/// let stream = ReaderStream::new(file);
/// let file_stream_resp = FileStream::new(stream).file_name("test.txt");
///
/// Ok(file_stream_resp.into_response())
Expand Down

0 comments on commit 9429e59

Please sign in to comment.