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

Method attach

std/src/storage/mod.rs:445–456  ·  view source on GitHub ↗

Attaches a new `drive` with `name`, which was instantiated with `uri`. The `name` must be valid and must not yet have been registered.

(&mut self, name: &str, uri: &str, drive: Box<dyn Drive>)

Source from the content-addressed store, hash-verified

443 ///
444 /// The `name` must be valid and must not yet have been registered.
445 fn attach(&mut self, name: &str, uri: &str, drive: Box<dyn Drive>) -> io::Result<()> {
446 let key = DriveKey::new(name)?;
447 if self.drives.contains_key(&key) {
448 return Err(io::Error::new(
449 io::ErrorKind::AlreadyExists,
450 format!("Drive '{}' is already mounted", name),
451 ));
452 }
453 let mounted_drive = MountedDrive { uri: uri.to_owned(), drive };
454 self.drives.insert(DriveKey::new(name)?, mounted_drive);
455 Ok(())
456 }
457
458 /// Instantiates and attaches a new `drive` with `name` that points to `uri`.
459 ///

Callers 10

test_dir_with_disk_freeFunction · 0.80
test_dir_other_by_cwdFunction · 0.80
test_mount_listFunction · 0.80
mountMethod · 0.80
test_storage_attach_okFunction · 0.80

Calls 1

insertMethod · 0.45

Tested by 9

test_dir_with_disk_freeFunction · 0.64
test_dir_other_by_cwdFunction · 0.64
test_mount_listFunction · 0.64
test_storage_attach_okFunction · 0.64