当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Rust OpenOptionsExt.custom_flags用法及代码示例


本文简要介绍rust语言中 std::os::windows::fs::OpenOptionsExt.custom_flags 的用法。

用法

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

将调用 CreateFile2 dwFileFlags 参数的额外标志设置为指定值(或将其与 attributessecurity_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-lang.org大神的英文原创作品 std::os::windows::fs::OpenOptionsExt.custom_flags。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。