#![allow(non_camel_case_types)]
#![allow(clippy::struct_excessive_bools)]
pub type gid_t = u32;
#[allow(unused)]
pub type ino_t = u64;
#[allow(unused)]
pub type nlink_t = u64;
pub type time_t = i64;
#[allow(unused)]
pub type uid_t = u32;
pub type flag_t = u32;
#[derive(PartialEq, Eq, PartialOrd, Ord, Copy, Clone)]
pub enum Type {
Directory,
File,
Link,
Pipe,
Socket,
CharDevice,
BlockDevice,
Special,
}
impl Type {
#[must_use]
pub fn is_regular_file(self) -> bool {
matches!(self, Self::File)
}
}
#[derive(Copy, Clone)]
#[rustfmt::skip]
pub struct Permissions {
pub user_read: bool,
pub user_write: bool,
pub user_execute: bool,
pub group_read: bool,
pub group_write: bool,
pub group_execute: bool,
pub other_read: bool,
pub other_write: bool,
pub other_execute: bool,
pub sticky: bool,
pub setgid: bool,
pub setuid: bool,
}
#[derive(Copy, Clone)]
#[rustfmt::skip]
#[cfg(windows)]
pub struct Attributes {
pub archive: bool,
pub directory: bool,
pub readonly: bool,
pub hidden: bool,
pub system: bool,
pub reparse_point: bool,
}
#[derive(Copy, Clone)]
pub struct PermissionsPlus {
#[allow(unused)]
pub file_type: Type,
#[cfg(unix)]
pub permissions: Permissions,
#[cfg(windows)]
pub attributes: Attributes,
#[allow(unused)]
pub xattrs: bool,
}
#[derive(Copy, Clone)]
pub struct OctalPermissions {
pub permissions: Permissions,
}
#[allow(unused)]
#[derive(Copy, Clone)]
pub struct Links {
pub count: nlink_t,
pub multiple: bool,
}
#[allow(unused)]
#[derive(Copy, Clone)]
pub struct Inode(pub ino_t);
#[derive(Copy, Clone)]
#[cfg(unix)]
pub enum Blocksize {
Some(u64),
None,
}
#[allow(unused)]
#[derive(Copy, Clone)]
pub struct User(pub uid_t);
#[allow(unused)]
#[derive(Copy, Clone)]
pub struct Group(pub gid_t);
#[derive(Copy, Clone)]
pub enum Size {
Some(u64),
None,
DeviceIDs(DeviceIDs),
}
#[derive(Copy, Clone)]
pub struct DeviceIDs {
pub major: u32,
pub minor: u32,
}
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct Time {
pub seconds: time_t,
pub nanoseconds: time_t,
}
#[derive(PartialEq, Eq, Copy, Clone)]
pub enum GitStatus {
NotModified,
New,
Modified,
Deleted,
Renamed,
TypeChange,
Ignored,
Conflicted,
}
#[derive(Copy, Clone)]
pub struct Git {
pub staged: GitStatus,
pub unstaged: GitStatus,
}
impl Default for Git {
fn default() -> Self {
Self {
staged: GitStatus::NotModified,
unstaged: GitStatus::NotModified,
}
}
}
pub enum SecurityContextType<'a> {
SELinux(&'a str),
None,
}
pub struct SecurityContext<'a> {
pub context: SecurityContextType<'a>,
}
#[allow(dead_code)]
#[derive(PartialEq, Copy, Clone)]
pub enum SubdirGitRepoStatus {
NoRepo,
GitClean,
GitDirty,
}
#[derive(Clone)]
pub struct SubdirGitRepo {
pub status: Option<SubdirGitRepoStatus>,
pub branch: Option<String>,
}
impl Default for SubdirGitRepo {
fn default() -> Self {
Self {
status: Some(SubdirGitRepoStatus::NoRepo),
branch: None,
}
}
}
pub struct Flags(pub flag_t);