#[non_exhaustive]pub enum ForgeKind {
GitHub,
GitLab,
Gitea,
}Expand description
Which forge backs a Forge handle.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Implementations§
Source§impl ForgeKind
impl ForgeKind
Sourcepub fn from_remote_url(url: &str) -> Option<ForgeKind>
pub fn from_remote_url(url: &str) -> Option<ForgeKind>
Best-effort guess of the forge from a git remote URL’s host, for the
public SaaS hosts: github.com → GitHub,
gitlab.com → GitLab, and gitea.com /
codeberg.org → Gitea — each matching the exact host
or a proper subdomain (*.gitlab.com), never a lookalike
(gitlab.com.evil.example → None).
Returns None for everything else: a self-hosted GitLab/Gitea lives on
an arbitrary domain that can’t be distinguished from any other host (and
must not be guessed from a substring, which an attacker-controlled host
could spoof), so pick the kind explicitly there. Accepts both
https://host/owner/repo(.git) and scp-like git@host:owner/repo.git.
Trait Implementations§
impl Copy for ForgeKind
impl Eq for ForgeKind
impl StructuralPartialEq for ForgeKind
Auto Trait Implementations§
impl Freeze for ForgeKind
impl RefUnwindSafe for ForgeKind
impl Send for ForgeKind
impl Sync for ForgeKind
impl Unpin for ForgeKind
impl UnsafeUnpin for ForgeKind
impl UnwindSafe for ForgeKind
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