#![allow(non_camel_case_types)]
#![allow(clippy::struct_excessive_bools)]
pub type blkcnt_t = u64;
pub type gid_t = u32;
pub type ino_t = u64;
pub type nlink_t = u64;
pub type uid_t = u32;
#[derive(PartialEq, Eq, PartialOrd, Ord, Copy, Clone)]
pub enum Type {
Directory,
File,
Link,
Pipe,
Socket,
CharDevice,
BlockDevice,
Special,
}
impl Type {
pub fn is_regular_file(self) -> bool {
matches!(self, Self::File)
}
}
#[derive(Copy, Clone)]
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,
}
#[cfg(windows)]
#[derive(Copy, Clone)]
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 {
pub file_type: Type,
#[cfg(unix)]
pub permissions: Permissions,
#[cfg(windows)]
pub attributes: Attributes,
pub xattrs: bool,
}
#[derive(Copy, Clone)]
pub struct OctalPermissions {
pub permissions: Permissions,
}
#[derive(Copy, Clone)]
pub struct Links {
pub count: nlink_t,
pub multiple: bool,
}
#[derive(Copy, Clone)]
pub struct Inode(pub ino_t);
#[derive(Copy, Clone)]
pub enum Blocks {
Some(blkcnt_t),
None,
}
#[derive(Copy, Clone)]
pub struct User(pub uid_t);
#[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: u8,
pub minor: u8,
}
#[derive(PartialEq, Eq, Copy, Clone)]
pub enum VcsStatus {
NotModified,
New,
Modified,
Deleted,
Renamed,
TypeChange,
Ignored,
Conflicted,
Copied,
Untracked,
}
#[derive(Copy, Clone)]
pub struct VcsFileStatus {
pub staged: VcsStatus,
pub unstaged: VcsStatus,
}
impl Default for VcsFileStatus {
fn default() -> Self {
Self {
staged: VcsStatus::NotModified,
unstaged: VcsStatus::NotModified,
}
}
}
pub type Git = VcsFileStatus;
pub type GitStatus = VcsStatus;
#[derive(Debug, Clone)]
pub enum VcsRepoStatus {
None,
Repo {
backend: &'static str,
clean: bool,
branch: Option<String>,
},
}