(&self, path: &str)
| 461 | /// Get entries within a directory. |
| 462 | #[allow(dead_code)] |
| 463 | fn list_directory_contents(&self, path: &str) -> Vec<String> { |
| 464 | let files = self.files.borrow(); |
| 465 | let prefix = if path.is_empty() { |
| 466 | String::new() |
| 467 | } else { |
| 468 | format!("{}/", path) |
| 469 | }; |
| 470 | |
| 471 | files |
| 472 | .keys() |
| 473 | .filter(|p| { |
| 474 | if prefix.is_empty() { |
| 475 | !p.contains('/') |
| 476 | } else { |
| 477 | p.starts_with(&prefix) && !p[prefix.len()..].contains('/') |
| 478 | } |
| 479 | }) |
| 480 | .cloned() |
| 481 | .collect() |
| 482 | } |
| 483 | } |
| 484 | |
| 485 | impl Default for Memory { |