| 514 | } |
| 515 | |
| 516 | fn read_file(&self, path: &str, buffer: &mut Vec<u8>) -> Result<(), Self::Error> { |
| 517 | let files = self.files.borrow(); |
| 518 | match files.get(path) { |
| 519 | Some(file) if file.metadata.is_dir => Err(MemoryError::IsADirectory { |
| 520 | path: path.to_string(), |
| 521 | }), |
| 522 | Some(file) => { |
| 523 | buffer.extend_from_slice(&file.contents); |
| 524 | Ok(()) |
| 525 | } |
| 526 | None => Err(MemoryError::NotFound { |
| 527 | path: path.to_string(), |
| 528 | }), |
| 529 | } |
| 530 | } |
| 531 | |
| 532 | fn modified_time(&self, path: &str) -> Result<SystemTime, Self::Error> { |
| 533 | let files = self.files.borrow(); |