MCPcopy Index your code
hub / github.com/endbasic/endbasic / unmount

Method unmount

std/src/storage/mod.rs:479–499  ·  view source on GitHub ↗

Detaches an existing drive named `name`. The drive `name` must exist, cannot be the current drive, and cannot be the last mounted drive.

(&mut self, name: &str)

Source from the content-addressed store, hash-verified

477 /// The drive `name` must exist, cannot be the current drive, and cannot be the last mounted
478 /// drive.
479 pub fn unmount(&mut self, name: &str) -> io::Result<()> {
480 let key = DriveKey::new(name)?;
481 if !self.drives.contains_key(&key) {
482 return Err(io::Error::new(
483 io::ErrorKind::NotFound,
484 format!("Drive '{}' is not mounted", name),
485 ));
486 }
487 if self.current == key {
488 return Err(io::Error::new(
489 io::ErrorKind::AlreadyExists,
490 format!("Cannot unmount the current drive '{}'", name),
491 ));
492 }
493 assert!(
494 self.drives.len() > 1,
495 "There must be more than one drive if the current drive is not the given name"
496 );
497 self.drives.remove(&key).expect("Drive presence in map checked above");
498 Ok(())
499 }
500
501 /// Returns information about the mounted drives as a mapping of drive names to the URIs that
502 /// were used to mount them.

Callers 5

async_execMethod · 0.80
execMethod · 0.80
test_mount_listFunction · 0.80
test_storage_unmount_okFunction · 0.80

Calls 1

removeMethod · 0.80

Tested by 3

test_mount_listFunction · 0.64
test_storage_unmount_okFunction · 0.64