use bitflags::bitflags;
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct Handle(u8);
impl Handle {
const STDIN: u8 = 0;
const STDOUT: u8 = 1;
const STDERR: u8 = 2;
pub const fn new(value: u8) -> Handle {
Handle(value)
}
pub const fn new_stdin() -> Handle {
Handle(Self::STDIN)
}
pub const fn new_stdout() -> Handle {
Handle(Self::STDOUT)
}
pub const fn new_stderr() -> Handle {
Handle(Self::STDERR)
}
pub const fn value(&self) -> u8 {
self.0
}
}
#[repr(C)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Stat {
pub file_size: u64,
pub ctime: Time,
pub mtime: Time,
pub attr: Attributes,
}
bitflags! {
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct Flags: u8 {
const WRITE = 0x01;
const CREATE = 0x02;
const TRUNCATE = 0x04;
}
}
bitflags! {
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct Attributes: u8 {
const READ_ONLY = 0x01;
const HIDDEN = 0x02;
const SYSTEM = 0x04;
const VOLUME = 0x08;
const DIRECTORY = 0x10;
const ARCHIVE = 0x20;
const DEVICE = 0x40;
}
}
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialOrd, Ord, PartialEq, Eq)]
pub struct Time {
pub year_since_1970: u8,
pub zero_indexed_month: u8,
pub zero_indexed_day: u8,
pub hours: u8,
pub minutes: u8,
pub seconds: u8,
}