async_vfs/
open_options.rs1#[derive(Debug, Default)]
2pub struct OpenOptions {
3 read: bool,
4 write: bool,
5 create: bool,
6 append: bool,
7 truncate: bool,
8}
9
10impl OpenOptions {
11 pub fn new() -> OpenOptions {
12 Default::default()
13 }
14
15 pub fn has_read(&self) -> bool {
16 self.read
17 }
18
19 pub fn read(mut self, read: bool) -> OpenOptions {
20 self.read = read;
21 self
22 }
23
24 pub fn has_write(&self) -> bool {
25 self.write
26 }
27
28 pub fn write(mut self, write: bool) -> OpenOptions {
29 self.write = write;
30 self
31 }
32
33 pub fn has_create(&self) -> bool {
34 self.create
35 }
36
37 pub fn create(mut self, create: bool) -> OpenOptions {
38 self.create = create;
39 self
40 }
41
42 pub fn has_append(&self) -> bool {
43 self.append
44 }
45
46 pub fn append(mut self, append: bool) -> OpenOptions {
47 self.append = append;
48 self
49 }
50
51 pub fn has_truncate(&self) -> bool {
52 self.truncate
53 }
54
55 pub fn truncate(mut self, truncate: bool) -> OpenOptions {
56 self.truncate = truncate;
57 self
58 }
59}