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 的 fs::OpenOptions 的扩展。

Required Methods§

source

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

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

将自定义 dirflags 参数传递给 path_open

此选项将 dirflags 参数配置为 OpenOptions 最终将调用的 path_open 系统调用。 dirflags 参数配置如何查找文件,当前主要影响是否遵循符号链接。

默认情况下,此值为 __WASI_LOOKUP_SYMLINK_FOLLOW,否则将遵循符号链接。 您可以使用 0 调用此方法以禁用以下符号链接

source

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

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

指示 OpenOptions 是否必须打开目录。

此方法将配置打开文件时是否传递 __WASI_O_DIRECTORY 标志。 传递时,将要求打开的路径是目录。

默认情况下,此选项为 false

source

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

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

指示是否在 path_openfs_flags 字段中传递 __WASI_FDFLAG_DSYNC

默认情况下,此选项为 false

source

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

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

指示是否在 path_openfs_flags 字段中传递 __WASI_FDFLAG_NONBLOCK

默认情况下,此选项为 false

source

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

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

指示是否在 path_openfs_flags 字段中传递 __WASI_FDFLAG_RSYNC

默认情况下,此选项为 false

source

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

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

指示是否在 path_openfs_flags 字段中传递 __WASI_FDFLAG_SYNC

默认情况下,此选项为 false

source

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

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

指示应为 path_openfs_rights_base 参数传递的值。

默认情况下,此选项基于此 OpenOptions 构建器的 readwrite 配置。 但是,如果调用此方法,则将使用传入的确切掩码。

source

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

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

指示应为 path_openfs_rights_inheriting 参数传递的值。

此选项的默认值与将为 fs_rights_base 参数传递的值相同,但是如果调用此方法,则将使用指定的值代替。

source

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

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

打开文件或目录。

这对应于 path_open syscall。

Implementors§