本文简要介绍rust语言中 std::os::windows::fs::OpenOptionsExt.custom_flags
的用法。
用法
fn custom_flags(&mut self, flags: u32) -> &mut Self
将调用 CreateFile2
的 dwFileFlags
参数的额外标志设置为指定值(或将其与 attributes
和 security_qos_flags
组合以设置 dwFlagsAndAttributes
的 CreateFile
)。
自定义标志只能设置标志,不能删除 Rust 选项设置的标志。此选项会覆盖任何先前设置的自定义标志。
例子
extern crate winapi;
use std::fs::OpenOptions;
use std::os::windows::prelude::*;
let file = OpenOptions::new()
.create(true)
.write(true)
.custom_flags(winapi::FILE_FLAG_DELETE_ON_CLOSE)
.open("foo.txt");
相关用法
- Rust OpenOptionsExt.custom_flags用法及代码示例
- Rust OpenOptionsExt.access_mode用法及代码示例
- Rust OpenOptionsExt.security_qos_flags用法及代码示例
- Rust OpenOptionsExt.mode用法及代码示例
- Rust OpenOptionsExt.share_mode用法及代码示例
- Rust OpenOptionsExt.attributes用法及代码示例
- Rust OpenOptions.append用法及代码示例
- Rust OpenOptions.new用法及代码示例
- Rust OpenOptions.create用法及代码示例
- Rust OpenOptions.write用法及代码示例
- Rust OpenOptions用法及代码示例
- Rust OpenOptions.open用法及代码示例
- Rust OpenOptions.create_new用法及代码示例
- Rust OpenOptions.truncate用法及代码示例
- Rust OpenOptions.read用法及代码示例
- Rust Option.unwrap_or_default用法及代码示例
- Rust Option.as_deref_mut用法及代码示例
- Rust Option.get_or_insert_with用法及代码示例
- Rust Option.iter_mut用法及代码示例
- Rust Option.or_else用法及代码示例
- Rust Option.unwrap_unchecked用法及代码示例
- Rust Option.get_or_insert用法及代码示例
- Rust Option.expect用法及代码示例
- Rust Option.get_or_insert_default用法及代码示例
- Rust Option.insert用法及代码示例
注:本文由纯净天空筛选整理自rust-lang.org大神的英文原创作品 std::os::windows::fs::OpenOptionsExt.custom_flags。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。