tempest-rt 0.0.1

TempestDB Deterministic Async Runtime
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Async directory listing operation.

use std::{io, path::PathBuf};

use tempest_io::{DirEntry, Io};

use crate::context::current_io;

/// Lists all entries in `dir`, returning them as a [`Vec<DirEntry>`].
// NB: io_uring does not support asynchronously listing directories
pub fn list_dir<I: Io>(dir: PathBuf) -> io::Result<Vec<DirEntry>> {
    // SAFETY: we do not hold on to io outside of this function
    let io = unsafe { current_io::<I>() };
    io.list_dir(&dir)
}