neotron_api/dir.rs
1//! Directory related types
2
3// ============================================================================
4// Imports
5// ============================================================================
6
7// None
8
9// ============================================================================
10// Constants
11// ============================================================================
12
13// None
14
15// ============================================================================
16// Types
17// ============================================================================
18
19/// Represents an open directory
20#[repr(C)]
21#[derive(Debug, PartialEq, Eq, Copy, Clone)]
22pub struct Handle(u8);
23
24impl Handle {
25 /// Construct a new `Handle` from an integer.
26 ///
27 /// Only the OS should call this - applications should not be constructing
28 /// their own dir handles! But if you do, you probably can't harm anything
29 /// and it's no worse that C just using `int`.
30 pub const fn new(value: u8) -> Handle {
31 Handle(value)
32 }
33
34 /// Get the numeric value of this Directory Handle
35 pub const fn value(&self) -> u8 {
36 self.0
37 }
38}
39
40/// Describes an entry in a directory.
41///
42/// This is set up for 8.3 filenames on MS-DOS FAT32 partitions currently.
43#[repr(C)]
44#[derive(Clone, Debug, PartialEq, Eq)]
45pub struct Entry {
46 /// The name and extension of the file.
47 ///
48 /// The name and extension are separated by a single '.'.
49 ///
50 /// The filename will be in ASCII. Unicode filenames are not supported.
51 pub name: [u8; crate::MAX_FILENAME_LEN],
52 /// The properties for the file/directory this entry represents.
53 pub properties: crate::file::Stat,
54}
55
56// ============================================================================
57// Functions
58// ============================================================================
59
60// None
61
62// ============================================================================
63// Tests
64// ============================================================================
65
66// None
67
68// ============================================================================
69// End of File
70// ============================================================================