Trait std::os::wasi::fs::OpenOptionsExt

source ·
pub trait OpenOptionsExt {
    // Required methods
    fn lookup_flags(&mut self, flags: u32) -> &mut Self;
    fn directory(&mut self, dir: bool) -> &mut Self;
    fn dsync(&mut self, dsync: bool) -> &mut Self;
    fn nonblock(&mut self, nonblock: bool) -> &mut Self;
    fn rsync(&mut self, rsync: bool) -> &mut Self;
    fn sync(&mut self, sync: bool) -> &mut Self;
    fn fs_rights_base(&mut self, rights: u64) -> &mut Self;
    fn fs_rights_inheriting(&mut self, rights: u64) -> &mut Self;
    fn open_at<P: AsRef<Path>>(&self, file: &File, path: P) -> Result<File>;
}
🔬This is a nightly-only experimental API. (wasi_ext #71213)
Available on WASI only.
Expand description

WASI-specific extensions to fs::OpenOptions.

Required Methods§

source

fn lookup_flags(&mut self, flags: u32) -> &mut Self

🔬This is a nightly-only experimental API. (wasi_ext #71213)

Pass custom dirflags argument to path_open.

This option configures the dirflags argument to the path_open syscall which OpenOptions will eventually call. The dirflags argument configures how the file is looked up, currently primarily affecting whether symlinks are followed or not.

By default this value is __WASI_LOOKUP_SYMLINK_FOLLOW, or symlinks are followed. You can call this method with 0 to disable following symlinks

source

fn directory(&mut self, dir: bool) -> &mut Self

🔬This is a nightly-only experimental API. (wasi_ext #71213)

Indicates whether OpenOptions must open a directory or not.

This method will configure whether the __WASI_O_DIRECTORY flag is passed when opening a file. When passed it will require that the opened path is a directory.

This option is by default false

source

fn dsync(&mut self, dsync: bool) -> &mut Self

🔬This is a nightly-only experimental API. (wasi_ext #71213)

Indicates whether __WASI_FDFLAG_DSYNC is passed in the fs_flags field of path_open.

This option is by default false

source

fn nonblock(&mut self, nonblock: bool) -> &mut Self

🔬This is a nightly-only experimental API. (wasi_ext #71213)

Indicates whether __WASI_FDFLAG_NONBLOCK is passed in the fs_flags field of path_open.

This option is by default false

source

fn rsync(&mut self, rsync: bool) -> &mut Self

🔬This is a nightly-only experimental API. (wasi_ext #71213)

Indicates whether __WASI_FDFLAG_RSYNC is passed in the fs_flags field of path_open.

This option is by default false

source

fn sync(&mut self, sync: bool) -> &mut Self

🔬This is a nightly-only experimental API. (wasi_ext #71213)

Indicates whether __WASI_FDFLAG_SYNC is passed in the fs_flags field of path_open.

This option is by default false

source

fn fs_rights_base(&mut self, rights: u64) -> &mut Self

🔬This is a nightly-only experimental API. (wasi_ext #71213)

Indicates the value that should be passed in for the fs_rights_base parameter of path_open.

This option defaults based on the read and write configuration of this OpenOptions builder. If this method is called, however, the exact mask passed in will be used instead.

source

fn fs_rights_inheriting(&mut self, rights: u64) -> &mut Self

🔬This is a nightly-only experimental API. (wasi_ext #71213)

Indicates the value that should be passed in for the fs_rights_inheriting parameter of path_open.

The default for this option is the same value as what will be passed for the fs_rights_base parameter but if this method is called then the specified value will be used instead.

source

fn open_at<P: AsRef<Path>>(&self, file: &File, path: P) -> Result<File>

🔬This is a nightly-only experimental API. (wasi_ext #71213)

Open a file or directory.

This corresponds to the path_open syscall.

Object Safety§

This trait is not object safe.

Implementors§