pub struct RepoRef { /* private fields */ }Expand description
A validated repository reference: a namespace and a name, and nothing else.
The only ways to obtain one are resolve_repo_path and RepoRef::new,
both of which validate. There is no constructor that takes a string
unchecked outside of [red], which exists to prove the checks bite.
Implementations§
Source§impl RepoRef
impl RepoRef
Sourcepub fn new(namespace: &str, name: &str) -> Result<Self>
pub fn new(namespace: &str, name: &str) -> Result<Self>
Validate a namespace and a repository name and pair them up.
The namespace may itself be nested (team/sub); every level is validated
by the same rules as the repository name.
Sourcepub fn key(&self) -> String
pub fn key(&self) -> String
The catalog key, <namespace>/<repo>. Stable, and the only identifier
the catalog stores.
Sourcepub fn to_ssh_path(&self) -> String
pub fn to_ssh_path(&self) -> String
The path as a client would write it after the colon:
<namespace>/<repo>.git.
Sourcepub fn path_under(&self, root: &Path) -> Result<PathBuf>
pub fn path_under(&self, root: &Path) -> Result<PathBuf>
Where this repository’s directory lives under root, checked against
symlink escapes.
The string checks in resolve_repo_path cannot see a symlink: ns may
be a perfectly ordinary-looking name that happens to be a link to /etc.
So the deepest existing ancestor of the target is canonicalised and
asserted to still be inside the canonicalised root.
This is for the fs backend only. The appliance has no filesystem and
never calls it.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RepoRef
impl<'de> Deserialize<'de> for RepoRef
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for RepoRef
Source§impl Ord for RepoRef
impl Ord for RepoRef
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for RepoRef
impl PartialOrd for RepoRef
impl StructuralPartialEq for RepoRef
Auto Trait Implementations§
impl Freeze for RepoRef
impl RefUnwindSafe for RepoRef
impl Send for RepoRef
impl Sync for RepoRef
impl Unpin for RepoRef
impl UnsafeUnpin for RepoRef
impl UnwindSafe for RepoRef
Blanket Implementations§
impl<T> Allocation for T
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.