|
41 | 41 | /// use std::pin::Pin; |
42 | 42 | /// use std::time::SystemTime; |
43 | 43 | /// |
44 | | -/// use dir_structure::{error::Result, traits::vfs, prelude::*}; |
| 44 | +/// use dir_structure::{error::VfsResult, traits::vfs, prelude::*}; |
45 | 45 | /// |
46 | 46 | /// // !collapse(1:4) collapsed |
47 | 47 | /// struct FsMtime<T> { |
|
50 | 50 | /// } |
51 | 51 | /// |
52 | 52 | /// // !mark(1:5) |
53 | | -/// impl<'vfs, Vfs: vfs::Vfs<'vfs>, T: ReadFrom<'vfs, Vfs>> ReadFrom<'vfs, Vfs> for FsMtime<T> { |
54 | | -/// fn read_from(path: &Path, vfs: Pin<&'vfs Vfs>) -> Result<Self> { |
| 53 | +/// impl<'vfs, Vfs: vfs::Vfs<'vfs, Path=Path>, T: ReadFrom<'vfs, Vfs>> ReadFrom<'vfs, Vfs> for FsMtime<T> { |
| 54 | +/// fn read_from(path: &Path, vfs: Pin<&'vfs Vfs>) -> VfsResult<Self, Vfs> { |
55 | 55 | /// todo!() |
56 | 56 | /// } |
57 | 57 | /// } |
|
68 | 68 | /// use std::pin::Pin; |
69 | 69 | /// use std::time::SystemTime; |
70 | 70 | /// |
71 | | -/// use dir_structure::{error::Result, traits::vfs, error::WrapIoError, prelude::*}; |
| 71 | +/// use dir_structure::{error::VfsResult, traits::vfs, error::WrapIoError, prelude::*}; |
72 | 72 | /// |
73 | 73 | /// // !collapse(1:4) collapsed |
74 | 74 | /// struct FsMtime<T> { |
75 | 75 | /// mtime: SystemTime, |
76 | 76 | /// value: T, |
77 | 77 | /// } |
78 | 78 | /// |
79 | | -/// impl<'vfs, Vfs: vfs::Vfs<'vfs>, T: ReadFrom<'vfs, Vfs>> ReadFrom<'vfs, Vfs> for FsMtime<T> { |
80 | | -/// fn read_from(path: &Path, vfs: Pin<&'vfs Vfs>) -> Result<Self> { |
| 79 | +/// impl<'vfs, Vfs: vfs::Vfs<'vfs, Path=Path>, T: ReadFrom<'vfs, Vfs>> ReadFrom<'vfs, Vfs> for FsMtime<T> { |
| 80 | +/// fn read_from(path: &Path, vfs: Pin<&'vfs Vfs>) -> VfsResult<Self, Vfs> { |
81 | 81 | /// // !mark(1:3) |
82 | 82 | /// let mtime = path.metadata() |
83 | 83 | /// .and_then(|m| m.modified()) |
|
98 | 98 | /// use std::pin::Pin; |
99 | 99 | /// use std::time::SystemTime; |
100 | 100 | /// |
101 | | -/// use dir_structure::{error::Result, traits::vfs, error::WrapIoError, prelude::*}; |
| 101 | +/// use dir_structure::{error::VfsResult, traits::vfs, error::WrapIoError, prelude::*}; |
102 | 102 | /// |
103 | 103 | /// // !collapse(1:4) collapsed |
104 | 104 | /// struct FsMtime<T> { |
105 | 105 | /// mtime: SystemTime, |
106 | 106 | /// value: T, |
107 | 107 | /// } |
108 | 108 | /// |
109 | | -/// impl<'vfs, Vfs: vfs::Vfs<'vfs>, T: ReadFrom<'vfs, Vfs>> ReadFrom<'vfs, Vfs> for FsMtime<T> { |
110 | | -/// fn read_from(path: &Path, vfs: Pin<&'vfs Vfs>) -> Result<Self> { |
| 109 | +/// impl<'vfs, Vfs: vfs::Vfs<'vfs, Path=Path>, T: ReadFrom<'vfs, Vfs>> ReadFrom<'vfs, Vfs> for FsMtime<T> { |
| 110 | +/// fn read_from(path: &Path, vfs: Pin<&'vfs Vfs>) -> VfsResult<Self, Vfs> { |
111 | 111 | /// let mtime = path.metadata() |
112 | 112 | /// .and_then(|m| m.modified()) |
113 | 113 | /// .wrap_io_error_with(path)?; |
|
129 | 129 | /// use std::pin::Pin; |
130 | 130 | /// use std::time::SystemTime; |
131 | 131 | /// |
132 | | -/// use dir_structure::{error::Result, traits::vfs, error::WrapIoError, prelude::*}; |
| 132 | +/// use dir_structure::{error::VfsResult, traits::vfs, error::WrapIoError, prelude::*}; |
133 | 133 | /// |
134 | 134 | /// // !collapse(1:4) collapsed |
135 | 135 | /// struct FsMtime<T> { |
|
138 | 138 | /// } |
139 | 139 | /// |
140 | 140 | /// // !collapse(1:9) |
141 | | -/// impl<'vfs, Vfs: vfs::Vfs<'vfs>, T: ReadFrom<'vfs, Vfs>> ReadFrom<'vfs, Vfs> for FsMtime<T> { |
142 | | -/// fn read_from(path: &Path, vfs: Pin<&'vfs Vfs>) -> Result<Self> { |
| 141 | +/// impl<'vfs, Vfs: vfs::Vfs<'vfs, Path=Path>, T: ReadFrom<'vfs, Vfs>> ReadFrom<'vfs, Vfs> for FsMtime<T> { |
| 142 | +/// fn read_from(path: &Path, vfs: Pin<&'vfs Vfs>) -> VfsResult<Self, Vfs> { |
143 | 143 | /// let mtime = path.metadata() |
144 | 144 | /// .and_then(|m| m.modified()) |
145 | 145 | /// .wrap_io_error_with(path)?; |
|
161 | 161 | /// use std::pin::Pin; |
162 | 162 | /// use std::time::SystemTime; |
163 | 163 | /// |
164 | | -/// use dir_structure::{error::Result, traits::vfs, error::WrapIoError, prelude::*}; |
| 164 | +/// use dir_structure::{error::VfsResult, traits::vfs, error::WrapIoError, prelude::*}; |
165 | 165 | /// |
166 | 166 | /// // !collapse(1:4) collapsed |
167 | 167 | /// struct FsMtime<T> { |
|
170 | 170 | /// } |
171 | 171 | /// |
172 | 172 | /// // !collapse(1:9) collapsed |
173 | | -/// impl<'vfs, Vfs: vfs::Vfs<'vfs>, T: ReadFrom<'vfs, Vfs>> ReadFrom<'vfs, Vfs> for FsMtime<T> { |
174 | | -/// fn read_from(path: &Path, vfs: Pin<&'vfs Vfs>) -> Result<Self> { |
| 173 | +/// impl<'vfs, Vfs: vfs::Vfs<'vfs, Path=Path>, T: ReadFrom<'vfs, Vfs>> ReadFrom<'vfs, Vfs> for FsMtime<T> { |
| 174 | +/// fn read_from(path: &Path, vfs: Pin<&'vfs Vfs>) -> VfsResult<Self, Vfs> { |
175 | 175 | /// let mtime = path.metadata() |
176 | 176 | /// .and_then(|m| m.modified()) |
177 | 177 | /// .wrap_io_error_with(path)?; |
|
181 | 181 | /// } |
182 | 182 | /// |
183 | 183 | /// // !mark(1:6) |
184 | | -/// impl<'vfs, Vfs: vfs::WriteSupportingVfs<'vfs>, T: WriteTo<'vfs, Vfs>> WriteTo<'vfs, Vfs> for FsMtime<T> { |
185 | | -/// fn write_to(&self, path: &Path, vfs: Pin<&'vfs Vfs>) -> Result<()> { |
| 184 | +/// impl<'vfs, Vfs: vfs::WriteSupportingVfs<'vfs, Path=Path>, T: WriteTo<'vfs, Vfs>> WriteTo<'vfs, Vfs> for FsMtime<T> { |
| 185 | +/// fn write_to(&self, path: &Path, vfs: Pin<&'vfs Vfs>) -> VfsResult<(), Vfs> { |
186 | 186 | /// todo!(); |
187 | 187 | /// Ok(()) |
188 | 188 | /// } |
|
200 | 200 | /// use std::pin::Pin; |
201 | 201 | /// use std::time::SystemTime; |
202 | 202 | /// |
203 | | -/// use dir_structure::{error::Result, traits::vfs, error::WrapIoError, prelude::*}; |
| 203 | +/// use dir_structure::{error::VfsResult, traits::vfs, error::WrapIoError, prelude::*}; |
204 | 204 | /// |
205 | 205 | /// // !collapse(1:4) collapsed |
206 | 206 | /// struct FsMtime<T> { |
|
209 | 209 | /// } |
210 | 210 | /// |
211 | 211 | /// // !collapse(1:9) collapsed |
212 | | -/// impl<'vfs, Vfs: vfs::Vfs<'vfs>, T: ReadFrom<'vfs, Vfs>> ReadFrom<'vfs, Vfs> for FsMtime<T> { |
213 | | -/// fn read_from(path: &Path, vfs: Pin<&'vfs Vfs>) -> Result<Self> { |
| 212 | +/// impl<'vfs, Vfs: vfs::Vfs<'vfs, Path=Path>, T: ReadFrom<'vfs, Vfs>> ReadFrom<'vfs, Vfs> for FsMtime<T> { |
| 213 | +/// fn read_from(path: &Path, vfs: Pin<&'vfs Vfs>) -> VfsResult<Self, Vfs> { |
214 | 214 | /// let mtime = path.metadata() |
215 | 215 | /// .and_then(|m| m.modified()) |
216 | 216 | /// .wrap_io_error_with(path)?; |
|
219 | 219 | /// } |
220 | 220 | /// } |
221 | 221 | /// |
222 | | -/// impl<'vfs, Vfs: vfs::WriteSupportingVfs<'vfs>, T: WriteTo<'vfs, Vfs>> WriteTo<'vfs, Vfs> for FsMtime<T> { |
223 | | -/// fn write_to(&self, path: &Path, vfs: Pin<&'vfs Vfs>) -> Result<()> { |
| 222 | +/// impl<'vfs, Vfs: vfs::WriteSupportingVfs<'vfs, Path=Path>, T: WriteTo<'vfs, Vfs>> WriteTo<'vfs, Vfs> for FsMtime<T> { |
| 223 | +/// fn write_to(&self, path: &Path, vfs: Pin<&'vfs Vfs>) -> VfsResult<(), Vfs> { |
224 | 224 | /// // !mark |
225 | 225 | /// self.value.write_to(path, vfs)?; |
226 | 226 | /// todo!(); |
|
239 | 239 | /// use std::pin::Pin; |
240 | 240 | /// use std::time::SystemTime; |
241 | 241 | /// |
242 | | -/// use dir_structure::{error::Result, traits::vfs, error::WrapIoError, prelude::*}; |
| 242 | +/// use dir_structure::{error::VfsResult, traits::vfs, error::WrapIoError, prelude::*}; |
243 | 243 | /// |
244 | 244 | /// // !collapse(1:4) collapsed |
245 | 245 | /// struct FsMtime<T> { |
|
248 | 248 | /// } |
249 | 249 | /// |
250 | 250 | /// // !collapse(1:9) collapsed |
251 | | -/// impl<'vfs, Vfs: vfs::Vfs<'vfs>, T: ReadFrom<'vfs, Vfs>> ReadFrom<'vfs, Vfs> for FsMtime<T> { |
252 | | -/// fn read_from(path: &Path, vfs: Pin<&'vfs Vfs>) -> Result<Self> { |
| 251 | +/// impl<'vfs, Vfs: vfs::Vfs<'vfs, Path=Path>, T: ReadFrom<'vfs, Vfs>> ReadFrom<'vfs, Vfs> for FsMtime<T> { |
| 252 | +/// fn read_from(path: &Path, vfs: Pin<&'vfs Vfs>) -> VfsResult<Self, Vfs> { |
253 | 253 | /// let mtime = path.metadata() |
254 | 254 | /// .and_then(|m| m.modified()) |
255 | 255 | /// .wrap_io_error_with(path)?; |
|
259 | 259 | /// } |
260 | 260 | /// |
261 | 261 | /// // !collapse(1:9) |
262 | | -/// impl<'vfs, Vfs: vfs::WriteSupportingVfs<'vfs>, T: WriteTo<'vfs, Vfs>> WriteTo<'vfs, Vfs> for FsMtime<T> { |
263 | | -/// fn write_to(&self, path: &Path, vfs: Pin<&'vfs Vfs>) -> Result<()> { |
| 262 | +/// impl<'vfs, Vfs: vfs::WriteSupportingVfs<'vfs, Path=Path>, T: WriteTo<'vfs, Vfs>> WriteTo<'vfs, Vfs> for FsMtime<T> { |
| 263 | +/// fn write_to(&self, path: &Path, vfs: Pin<&'vfs Vfs>) -> VfsResult<(), Vfs> { |
264 | 264 | /// self.value.write_to(path, vfs)?; |
265 | 265 | /// // !mark(1:3) |
266 | 266 | /// std::fs::File::open(path) |
|
285 | 285 | /// use std::pin::Pin; |
286 | 286 | /// use std::time::SystemTime; |
287 | 287 | /// |
288 | | -/// use dir_structure::{DirStructure, traits::sync::DirStructureItem, error::Result, traits::vfs, error::WrapIoError, prelude::*}; |
| 288 | +/// use dir_structure::{DirStructure, traits::sync::DirStructureItem, error::VfsResult, traits::vfs, error::WrapIoError, prelude::*}; |
289 | 289 | /// |
290 | 290 | /// // !collapse(1:4) |
291 | 291 | /// struct FsMtime<T> { |
|
294 | 294 | /// } |
295 | 295 | /// |
296 | 296 | /// // !collapse(1:9) |
297 | | -/// impl<'vfs, Vfs: vfs::Vfs<'vfs>, T: ReadFrom<'vfs, Vfs>> ReadFrom<'vfs, Vfs> for FsMtime<T> { |
298 | | -/// fn read_from(path: &Path, vfs: Pin<&'vfs Vfs>) -> Result<Self> { |
| 297 | +/// impl<'vfs, Vfs: vfs::Vfs<'vfs, Path=Path>, T: ReadFrom<'vfs, Vfs>> ReadFrom<'vfs, Vfs> for FsMtime<T> { |
| 298 | +/// fn read_from(path: &Path, vfs: Pin<&'vfs Vfs>) -> VfsResult<Self, Vfs> { |
299 | 299 | /// let mtime = path.metadata() |
300 | 300 | /// .and_then(|m| m.modified()) |
301 | 301 | /// .wrap_io_error_with(path)?; |
|
305 | 305 | /// } |
306 | 306 | /// |
307 | 307 | /// // !collapse(1:9) |
308 | | -/// impl<'vfs, Vfs: vfs::WriteSupportingVfs<'vfs>, T: WriteTo<'vfs, Vfs>> WriteTo<'vfs, Vfs> for FsMtime<T> { |
309 | | -/// fn write_to(&self, path: &Path, vfs: Pin<&'vfs Vfs>) -> Result<()> { |
| 308 | +/// impl<'vfs, Vfs: vfs::WriteSupportingVfs<'vfs, Path=Path>, T: WriteTo<'vfs, Vfs>> WriteTo<'vfs, Vfs> for FsMtime<T> { |
| 309 | +/// fn write_to(&self, path: &Path, vfs: Pin<&'vfs Vfs>) -> VfsResult<(), Vfs> { |
310 | 310 | /// self.value.write_to(path, vfs)?; |
311 | 311 | /// std::fs::File::open(path) |
312 | 312 | /// .and_then(|f| f.set_modified(self.mtime)) |
|
318 | 318 | /// // !mark(1:9) |
319 | 319 | /// // !collapse(1:5) |
320 | 320 | /// #[derive(DirStructure)] |
321 | | -/// struct Dir { |
| 321 | +/// struct Dir<Vfs: vfs::VfsCore<Path=Path>> { |
322 | 322 | /// #[dir_structure(path = "file.txt")] |
323 | 323 | /// file: FsMtime<String>, |
| 324 | +/// __marker: std::marker::PhantomData<Vfs>, |
324 | 325 | /// } |
325 | 326 | /// |
326 | 327 | /// let path = "dir"; |
327 | 328 | /// let mut dir = Dir::read(path)?; |
328 | 329 | /// dir.file.mtime = SystemTime::UNIX_EPOCH; |
329 | 330 | /// dir.write(path)?; |
330 | | -/// Ok::<_, dir_structure::error::Error>(()) |
| 331 | +/// Ok::<_, dir_structure::error::Error::<std::path::PathBuf>>(()) |
331 | 332 | /// |
332 | 333 | /// ``` |
333 | 334 | /// |
|
0 commit comments