A better Rust ATProto crate

renamed UriPath to RepoPath for clarity

Orual 42f14e72 87879fab

Changed files
+22 -22
crates
jacquard-common
+19 -19
crates/jacquard-common/src/types/aturi.rs
···
pub authority: AtIdentifier<'this>,
#[borrows(uri)]
#[covariant]
-
pub path: Option<UriPath<'this>>,
+
pub path: Option<RepoPath<'this>>,
#[borrows(uri)]
#[covariant]
pub fragment: Option<CowStr<'this>>,
···
} else {
None
};
-
Some(UriPath { collection, rkey })
+
Some(RepoPath { collection, rkey })
} else {
None
}
···
/// at:// URI path component (current subset)
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
-
pub struct UriPath<'u> {
+
pub struct RepoPath<'u> {
pub collection: Nsid<'u>,
pub rkey: Option<RecordKey<Rkey<'u>>>,
}
-
impl IntoStatic for UriPath<'_> {
-
type Output = UriPath<'static>;
+
impl IntoStatic for RepoPath<'_> {
+
type Output = RepoPath<'static>;
fn into_static(self) -> Self::Output {
-
UriPath {
+
RepoPath {
collection: self.collection.into_static(),
rkey: self.rkey.map(|rkey| rkey.into_static()),
}
}
}
-
pub type UriPathBuf = UriPath<'static>;
+
pub type UriPathBuf = RepoPath<'static>;
pub static ATURI_REGEX: LazyLock<Regex> = LazyLock::new(|| {
// Fragment allows: / and \ and other special chars. In raw string, backslashes are literal.
···
} else {
None
};
-
Some(UriPath { collection, rkey })
+
Some(RepoPath { collection, rkey })
} else {
None
};
···
} else {
None
};
-
Some(UriPath { collection, rkey })
+
Some(RepoPath { collection, rkey })
} else {
None
};
···
} else {
None
};
-
Some(UriPath { collection, rkey })
+
Some(RepoPath { collection, rkey })
} else {
None
};
···
self.inner.borrow_authority()
}
-
pub fn path(&self) -> &Option<UriPath<'_>> {
+
pub fn path(&self) -> &Option<RepoPath<'_>> {
self.inner.borrow_path()
}
···
} else {
None
};
-
Some(UriPath { collection, rkey })
+
Some(RepoPath { collection, rkey })
} else {
None
};
···
} else {
None
};
-
Some(UriPath { collection, rkey })
+
Some(RepoPath { collection, rkey })
} else {
None
}
···
} else {
None
};
-
Some(UriPath { collection, rkey })
+
Some(RepoPath { collection, rkey })
} else {
None
};
···
} else {
None
};
-
Some(UriPath { collection, rkey })
+
Some(RepoPath { collection, rkey })
} else {
None
};
···
} else {
None
};
-
Some(UriPath { collection, rkey })
+
Some(RepoPath { collection, rkey })
} else {
None
}
···
} else {
None
};
-
Some(UriPath { collection, rkey })
+
Some(RepoPath { collection, rkey })
} else {
None
}
···
} else {
None
};
-
Some(UriPath { collection, rkey })
+
Some(RepoPath { collection, rkey })
} else {
None
};
···
} else {
None
};
-
Some(UriPath { collection, rkey })
+
Some(RepoPath { collection, rkey })
} else {
None
}
+3 -3
crates/jacquard-common/src/types/collection.rs
···
use serde::Serialize;
use crate::types::{
-
aturi::UriPath,
+
aturi::RepoPath,
nsid::Nsid,
recordkey::{RecordKey, RecordKeyType, Rkey},
};
···
/// [`Nsid`]: crate::types::string::Nsid
fn repo_path<'u, T: RecordKeyType>(
rkey: &'u crate::types::recordkey::RecordKey<T>,
-
) -> UriPath<'u> {
-
UriPath {
+
) -> RepoPath<'u> {
+
RepoPath {
collection: Self::nsid(),
rkey: Some(RecordKey::from(Rkey::raw(rkey.as_ref()))),
}