From 03bb6e29b173ca15750e57823c9119bce9704fef Mon Sep 17 00:00:00 2001 From: Martin Grigorov Date: Tue, 9 Sep 2025 11:12:07 +0300 Subject: [PATCH] fs: add `File::max_buf_size` (#7594) --- tokio/src/fs/file.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tokio/src/fs/file.rs b/tokio/src/fs/file.rs index 8d8bc9fb5..d8b01ef12 100644 --- a/tokio/src/fs/file.rs +++ b/tokio/src/fs/file.rs @@ -579,6 +579,11 @@ impl File { pub fn set_max_buf_size(&mut self, max_buf_size: usize) { self.max_buf_size = max_buf_size; } + + /// Get the maximum buffer size for the underlying [`AsyncRead`] / [`AsyncWrite`] operation. + pub fn max_buf_size(&self) -> usize { + self.max_buf_size + } } impl AsyncRead for File {