Sync computers

This commit is contained in:
2026-02-28 18:55:10 +01:00
parent c3eb93e701
commit 9a983c56f3
29 changed files with 1564 additions and 28 deletions

33
crates/bffs/src/path.rs Normal file
View File

@@ -0,0 +1,33 @@
pub struct Path<'a> {
inner: &'a str,
}
impl<'a> From<&'a str> for Path<'a> {
fn from(value: &'a str) -> Self {
Self { inner: value }
}
}
impl<'a> AsRef<str> for Path<'a> {
fn as_ref(&self) -> &str {
self.inner
}
}
impl<'a> Path<'a> {
pub fn split_path(&self) -> (&'a str, Option<Path<'a>>) {
if let Some((start, end)) = self.inner.split_once("/") {
(start, Some(end.into()))
} else {
(self.inner, None)
}
}
pub fn as_str(&self) -> &'a str {
self.inner
}
pub fn is_absolute(&self) -> bool {
self.inner.starts_with("/")
}
pub fn is_relative(&self) -> bool {
!self.is_absolute()
}
}