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


Rust FileTypeExt.is_char_device用法及代码示例


本文简要介绍rust语言中 std::os::unix::fs::FileTypeExt.is_char_device 的用法。

用法

fn is_char_device(&self) -> bool

如果此文件类型是字符设备,则返回 true

例子

use std::fs;
use std::os::unix::fs::FileTypeExt;
use std::io;

fn main() -> io::Result<()> {
    let meta = fs::metadata("char_device_file")?;
    let file_type = meta.file_type();
    assert!(file_type.is_char_device());
    Ok(())
}

相关用法


注:本文由纯净天空筛选整理自rust-lang.org大神的英文原创作品 std::os::unix::fs::FileTypeExt.is_char_device。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。