use std::fs;
use std::os::unix::fs::FileTypeExt;
use std::io;
fn main() -> io::Result<()> {
let meta = fs::metadata("block_device_file")?;
let file_type = meta.file_type();
assert!(file_type.is_block_device());
Ok(())
}
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(())
}
use std::fs;
use std::os::unix::fs::FileTypeExt;
use std::io;
fn main() -> io::Result<()> {
let meta = fs::metadata("fifo_file")?;
let file_type = meta.file_type();
assert!(file_type.is_fifo());
Ok(())
}
use std::fs;
use std::os::unix::fs::FileTypeExt;
use std::io;
fn main() -> io::Result<()> {
let meta = fs::metadata("unix.socket")?;
let file_type = meta.file_type();
assert!(file_type.is_socket());
Ok(())
}