MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / to_relative

Method to_relative

atomic-repository/src/repository/mod.rs:1436–1441  ·  view source on GitHub ↗

Convert an absolute path to a repository-relative path.

(&self, path: P)

Source from the content-addressed store, hash-verified

1434
1435 /// Convert an absolute path to a repository-relative path.
1436 pub fn to_relative<P: AsRef<Path>>(&self, path: P) -> Option<PathBuf> {
1437 path.as_ref()
1438 .strip_prefix(&self.root)
1439 .ok()
1440 .map(Path::to_path_buf)
1441 }
1442
1443 /// Convert a repository-relative path to an absolute path.
1444 pub fn to_absolute<P: AsRef<Path>>(&self, path: P) -> PathBuf {

Callers 1

test_to_relativeFunction · 0.80

Calls 2

as_refMethod · 0.80
okMethod · 0.45

Tested by 1

test_to_relativeFunction · 0.64