MCPcopy Create free account
hub / github.com/MultiFuzz/MultiFuzz / from_str

Method from_str

icicle-cortexm/src/config.rs:445–468  ·  view source on GitHub ↗
(str: &str)

Source from the content-addressed store, hash-verified

443 type Err = ();
444
445 fn from_str(str: &str) -> Result<Self, ()> {
446 let bytes = str.as_bytes();
447 if bytes.len() != 3 {
448 return Err(());
449 }
450
451 let mut perm = perm::MAP;
452 perm |= match bytes[0] {
453 b'r' => perm::READ,
454 b'-' => perm::NONE,
455 _ => return Err(()),
456 };
457 perm |= match bytes[1] {
458 b'w' => perm::WRITE,
459 b'-' => perm::NONE,
460 _ => return Err(()),
461 };
462 perm |= match bytes[2] {
463 b'x' => perm::EXEC,
464 b'-' => perm::NONE,
465 _ => return Err(()),
466 };
467 Ok(Self(perm))
468 }
469}
470
471impl<'de> Deserialize<'de> for Permissions {

Callers

nothing calls this directly

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected