1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
//! A Rust library to interact with GPT / MBR partition tables.
//!
//! It provides a set of tools to interact with storage devices at the partition table level,
//! supporting both Master Boot Record (MBR) and GUID Partition Table (GPT) formats.
//!
//! The library is designed to make it easy to read, write, and manipulate partition tables
//! for a variety of use cases, such as bootloader development, disk management utilities, or
//! storage diagnostics.
extern crate static_assertions;
pub use ;
pub use ;
extern crate alloc;
extern crate std;
pub use Read as DiskRead;
pub use Write as DiskWrite;
pub use Seek as DiskSeek;
pub use SeekFrom;
/// A trait for reading data from a disk-like device.
///
/// # Errors
/// The `read` method returns a `Result` indicating the number of bytes successfully read or an error.
/// An error is represented as a unit type (`()`).
///
/// # Examples
///
/// ```rust
/// use fzpart::DiskRead;
///
/// struct MyDevice;
///
/// impl DiskRead for MyDevice {
/// fn read(&mut self, buf: &mut [u8]) -> Result<usize, ()> {
/// // Custom implementation for reading data
/// Ok(0) // Placeholder
/// }
/// }
/// ```
/// A trait for writing data to a disk-like device.
///
/// # Errors
///
/// The `write` method returns a `Result` indicating the number of bytes successfully written or an error.
///
/// # Examples
///
/// ```rust
/// use fzpart::DiskWrite;
///
/// struct MyDevice;
///
/// impl DiskWrite for MyDevice {
/// fn write(&mut self, buf: &[u8]) -> Result<usize, ()> {
/// // Custom implementation for writing data
/// Ok(buf.len()) // Placeholder
/// }
/// }
/// ```
/// Defines possible seek operations for a disk-like device.
///
/// # Examples
///
/// ```rust
/// use fzpart::SeekFrom;
///
/// let seek_operation = SeekFrom::Start(1024);
/// ```
/// A trait for moving the read/write pointer within a disk-like device.
///
/// # Errors
///
/// The `seek` method returns a `Result` indicating the new position or an error.
///
/// # Examples
///
/// ```rust
/// use fzpart::{DiskSeek, SeekFrom};
///
/// struct MyDevice;
///
/// impl DiskSeek for MyDevice {
/// fn seek(&mut self, pos: SeekFrom) -> Result<u64, ()> {
/// // Custom implementation for seeking
/// Ok(0) // Placeholder
/// }
/// }
/// ```