You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: dir.rs
    path of file: ./repos/rustix/tests/fs
    
    the code of the file until where you have to start completion: #[test]
fn test_dir_read_from() {
    let t = rustix::fs::openat(
        rustix::fs::CWD,
        rustix::cstr!("."),
        rustix::fs::OFlags::RDONLY | rustix::fs::OFlags::CLOEXEC,
        rustix::fs::M
    
fn test_dir_new() {
    let t = rustix::fs::openat(
        rustix::fs::CWD,
        rustix::cstr!("."),
        rustix::fs::OFlags::RDONLY | rustix::fs::OFlags::CLOEXEC,
        rustix::fs::Mode::empty(),
    )
    .unwrap();

    let _file = rustix::fs::openat(
        &t,
        rustix::cstr!("Cargo.toml"),
        rustix::fs::OFlags::RDONLY | rustix::fs::OFlags::CLOEXEC,
        rustix::fs::Mode::empty(),
    )
    .unwrap();

    let mut dir = rustix::fs::Dir::new(t).unwrap();

    // Read the directory entries. We use `while let Some(entry)` so that we
    // don't consume the `Dir` so that we can run more tests on it.
    let mut saw_dot = false;
    let mut saw_dotdot = false;
    let mut saw_cargo_toml = false;
    while let Some(entry) = dir.read() {
        let entry = entry.unwrap();
        if entry.file_name() == rustix::cstr!(".") {
            saw_dot = true;
        } else if entry.file_name() == rustix::cstr!("..") {
            saw_dotdot = true;
        } else if entry.file_name() == rustix::cstr!("Cargo.toml") {
            saw_cargo_toml = true;
        }
    }
    assert!(saw_dot);
    assert!(saw_dotdot);
    assert!(saw_cargo_toml);

    // Rewind the directory so we can iterate over the entries again.
    dir.rewind();

    // For what comes next, we don't need `mut` anymore.
    let dir = dir;

    // Read the directory entries, again. This time we use `for entry in dir`.
    let mut saw_dot = false;
    let mut saw_dotdot = false;
    let mut saw_cargo_toml = false;
    for entry in dir {
        let entry = entry.unwrap();
        if entry.file_name() == rustix::cstr!(".") {
            saw_dot = true;
        } else if entry.file_name() == rustix::cstr!("..") {
            saw_dotdot = true;
        } else if entry.file_name() == rustix::cstr!("Cargo.toml") {
            saw_cargo_toml = true;
        }
    }
    assert!(saw_dot);
    assert!(saw_dotdot);
    assert!(saw_cargo_toml);
}