simple_fatfs/fat/
options.rs1use crate::*;
2
3#[cfg(not(feature = "std"))]
4use alloc::boxed::Box;
5
6#[derive(Debug)]
7pub struct FSOptions {
9 pub(crate) clock: Box<dyn Clock>,
10 pub(crate) codepage: codepage::Codepage,
11 pub(crate) update_file_fields: bool,
12}
13
14impl FSOptions {
15 #[inline]
16 pub fn new() -> Self {
20 Self::default()
21 }
22
23 pub fn set_codepage(&mut self, codepage: Codepage) {
25 self.codepage = codepage
26 }
27
28 pub fn with_codepage(mut self, codepage: Codepage) -> Self {
30 self.set_codepage(codepage);
31
32 self
33 }
34
35 pub fn set_update_file_fields(&mut self, update: bool) {
37 self.update_file_fields = update
38 }
39
40 pub fn with_update_file_fields(mut self, update: bool) -> Self {
42 self.update_file_fields = update;
43
44 self
45 }
46}
47
48impl Default for FSOptions {
49 fn default() -> Self {
50 Self {
51 clock: Box::new(DefaultClock),
52 codepage: codepage::Codepage::CP437,
53 update_file_fields: false,
54 }
55 }
56}