pub struct CanonicalRepoName(/* private fields */);Expand description
A GitHub owner/repo in the canonical casing GitHub reports for the repository.
GitHub resolves repository names case-insensitively, but OSV.dev’s GitHub Actions
package names are exact-case, so a uses: value written in another casing only matches
advisories once mapped to this spelling. Constructible only from a GitHub API URL the
server itself returned, never from user-written text.
§Examples
use deps_core::github::CanonicalRepoName;
let name = CanonicalRepoName::from_commit_url(
"https://api.github.com/repos/Azure/setup-kubectl/commits/0123abcd",
)
.unwrap();
assert_eq!(name.as_str(), "Azure/setup-kubectl");
assert!(CanonicalRepoName::from_commit_url("").is_none());Implementations§
Source§impl CanonicalRepoName
impl CanonicalRepoName
Sourcepub fn from_commit_url(url: &str) -> Option<Self>
pub fn from_commit_url(url: &str) -> Option<Self>
Extracts the repository from a .../repos/{owner}/{repo}/commits/{sha} API URL.
Returns None when url has no such shape or the owner/repo fails
validate_owner_repo.
Trait Implementations§
Source§impl Clone for CanonicalRepoName
impl Clone for CanonicalRepoName
Source§impl Debug for CanonicalRepoName
impl Debug for CanonicalRepoName
impl Eq for CanonicalRepoName
Source§impl Hash for CanonicalRepoName
impl Hash for CanonicalRepoName
Source§impl PartialEq for CanonicalRepoName
impl PartialEq for CanonicalRepoName
impl StructuralPartialEq for CanonicalRepoName
Auto Trait Implementations§
impl Freeze for CanonicalRepoName
impl RefUnwindSafe for CanonicalRepoName
impl Send for CanonicalRepoName
impl Sync for CanonicalRepoName
impl Unpin for CanonicalRepoName
impl UnsafeUnpin for CanonicalRepoName
impl UnwindSafe for CanonicalRepoName
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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§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
Compare self to
key and return true if they are equal.