MCPcopy Create free account
hub / github.com/bootc-dev/bootc / tmpfiles_entry_get_path

Function tmpfiles_entry_get_path

crates/tmpfiles/src/lib.rs:514–530  ·  view source on GitHub ↗
(line: &str)

Source from the content-addressed store, hash-verified

512}
513
514fn tmpfiles_entry_get_path(line: &str) -> Result<PathBuf> {
515 let err = || Error::MalformedTmpfilesEntry(line.to_string());
516 let mut it = line.as_bytes().iter().copied().peekable();
517 // Skip leading whitespace
518 while it.next_if(|c| c.is_ascii_whitespace()).is_some() {}
519 // Skip the file type
520 let mut found_ftype = false;
521 while it.next_if(|c| !c.is_ascii_whitespace()).is_some() {
522 found_ftype = true
523 }
524 if !found_ftype {
525 return Err(err());
526 }
527 // Skip trailing whitespace
528 while it.next_if(|c| c.is_ascii_whitespace()).is_some() {}
529 unescape_path(&mut it)
530}
531
532#[cfg(test)]
533mod tests {

Callers 2

read_tmpfiles_from_dirFunction · 0.85

Calls 2

unescape_pathFunction · 0.85
iterMethod · 0.45

Tested by 1