What platform (target) are you building? It is not present on MacOS as @parasyte said. Search for F_NOCACHE
to see how to bypass the fs cache on MacOS (I haven't tried it).
Even on Linux it must be set in FileOptions using a platform specific OpenOptionsExt.
#[cfg(unix)]
pub mod file {
use std::fs::OpenOptions;
use std::os::unix::fs::OpenOptionsExt;
pub fn open_direct(opts: &mut OpenOptions) -> &mut OpenOptions {
opts.custom_flags(libc::O_DIRECT)
}
}