brush_core/sys/
fs.rs

1//! Filesystem utilities
2
3pub use super::platform::fs::*;
4
5/// Extension trait for path-related filesystem operations.
6pub trait PathExt {
7    /// Returns true if the path exists and is readable by the current user.
8    fn readable(&self) -> bool;
9    /// Returns true if the path exists and is writable by the current user.
10    fn writable(&self) -> bool;
11    /// Returns true if the path exists and is executable by the current user.
12    fn executable(&self) -> bool;
13
14    /// Returns true if the path exists and is a block device.
15    fn exists_and_is_block_device(&self) -> bool;
16    /// Returns true if the path exists and is a character device.
17    fn exists_and_is_char_device(&self) -> bool;
18    /// Returns true if the path exists and is a FIFO (named pipe).
19    fn exists_and_is_fifo(&self) -> bool;
20    /// Returns true if the path exists and is a socket.
21    fn exists_and_is_socket(&self) -> bool;
22    /// Returns true if the path exists and has the setgid bit set.
23    fn exists_and_is_setgid(&self) -> bool;
24    /// Returns true if the path exists and has the setuid bit set.
25    fn exists_and_is_setuid(&self) -> bool;
26    /// Returns true if the path exists and has the sticky bit set.
27    fn exists_and_is_sticky_bit(&self) -> bool;
28
29    /// Returns the device ID and inode number for the path.
30    fn get_device_and_inode(&self) -> Result<(u64, u64), crate::error::Error>;
31}