Skip to main content

base_scheduler/
file_options.rs

1// Released under the MIT License.
2// Copyright, 2026, by Samuel Williams.
3
4/// Portable regular-file opening options. Fields are visible to alternative implementations, including simulated filesystems. Append mode is omitted: positioned writes must target the supplied offset.
5#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
6pub struct FileOptions {
7    pub read: bool,
8    pub write: bool,
9    pub create: bool,
10    pub create_new: bool,
11    pub truncate: bool,
12}
13
14impl FileOptions {
15    pub const READ: Self = Self {
16        read: true,
17        write: false,
18        create: false,
19        create_new: false,
20        truncate: false,
21    };
22    pub const CREATE: Self = Self {
23        read: false,
24        write: true,
25        create: true,
26        create_new: false,
27        truncate: true,
28    };
29}