Instantiates and attaches a new `drive` with `name` that points to `uri`. The `name` must be valid and must not yet have been registered.
(&mut self, name: &str, uri: &str)
| 459 | /// |
| 460 | /// The `name` must be valid and must not yet have been registered. |
| 461 | pub fn mount(&mut self, name: &str, uri: &str) -> io::Result<()> { |
| 462 | let (scheme, path) = split_uri(uri)?; |
| 463 | let drive = match self.factories.get(&scheme.to_lowercase()) { |
| 464 | Some(factory) => factory.create(path)?, |
| 465 | None => { |
| 466 | return Err(io::Error::new( |
| 467 | io::ErrorKind::InvalidInput, |
| 468 | format!("Unknown mount scheme '{}'", scheme), |
| 469 | )); |
| 470 | } |
| 471 | }; |
| 472 | self.attach(name, uri, drive) |
| 473 | } |
| 474 | |
| 475 | /// Detaches an existing drive named `name`. |
| 476 | /// |