diff options
| author | Alejandro Soto <alejandro@34project.org> | 2021-12-29 04:56:41 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2021-12-29 05:20:49 -0600 |
| commit | 48efcd0ce8c8a9ac51dc80c6ec49c63f6694b031 (patch) | |
| tree | bdb330a1bb59958ca914be40c906112d25b1eb39 /examples/ext2.rs | |
| parent | 606846f23726c3472e6e12b17447b102ad6158cc (diff) | |
Implement buffered readdir
Diffstat (limited to 'examples/ext2.rs')
| -rw-r--r-- | examples/ext2.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/ext2.rs b/examples/ext2.rs index 4d074e9..3a68eee 100644 --- a/examples/ext2.rs +++ b/examples/ext2.rs @@ -147,7 +147,7 @@ impl Ext2 { &self, inode: &'static Inode, start: u64, - ) -> impl Stream<Item = Result<Entry<&'static OsStr, Resolved>, Errno>> + '_ { + ) -> impl Stream<Item = Result<Entry<'static, Resolved>, Errno>> + '_ { stream::try_unfold(start, move |mut position| async move { loop { if position == inode.i_size as u64 { @@ -417,7 +417,8 @@ impl Ext2 { } async fn readdir<'o>(&self, (request, reply): Op<'o, Readdir>) -> Done<'o> { - let (mut reply, inode) = reply.fallible(self.inode(request.ino()))?; + let (reply, inode) = reply.fallible(self.inode(request.ino()))?; + let mut reply = reply.buffered(Vec::new()); let stream = self.directory_stream(inode, request.offset()); tokio::pin!(stream); |
