pub struct HostedGitInfo { /* private fields */ }
Expand description
The parsed information from a git hosting URL.
Implementations§
Source§impl HostedGitInfo
impl HostedGitInfo
Sourcepub fn from_url(giturl: &str) -> Result<Self, ParseError>
pub fn from_url(giturl: &str) -> Result<Self, ParseError>
Parses a URL string and returns a HostedGitInfo struct, if successful. If parsing fails, a ParseError will be returned.
Sourcepub fn provider(&self) -> Provider
pub fn provider(&self) -> Provider
The type of hosting provider. (GitHub, Gitlab, Bitbucket, …)
Sourcepub fn user(&self) -> Option<&str>
pub fn user(&self) -> Option<&str>
The name of the user or organization on the git host.
This is using an Option because some hosting providers allow projects that are not scoped to a particular user or organization.
Example: https://github.com/Turbo87/hosted-git-info-rs.git
→ Turbo87
Sourcepub fn auth(&self) -> Option<&str>
pub fn auth(&self) -> Option<&str>
The authentication part of the URL, if it exists.
Format: <USER>[:<PASSWORD>]
Example: https://user:password@github.com/foo/bar.git
→ user:password
Sourcepub fn project(&self) -> &str
pub fn project(&self) -> &str
The name of the project on the git host.
Example: https://github.com/Turbo87/hosted-git-info-rs.git
→ hosted-git-info-rs
Sourcepub fn committish(&self) -> Option<&str>
pub fn committish(&self) -> Option<&str>
The branch, tag, commit, … part of the URL, if it exists.
Example: https://github.com/Turbo87/hosted-git-info-rs.git#rust-is-awesome
→ rust-is-awesome
Sourcepub fn default_representation(&self) -> DefaultRepresentation
pub fn default_representation(&self) -> DefaultRepresentation
The original URL type (shortcut, https, ssh, …).
Example: https://github.com/Turbo87/hosted-git-info-rs.git
→ Https
Trait Implementations§
Source§impl Clone for HostedGitInfo
impl Clone for HostedGitInfo
Source§fn clone(&self) -> HostedGitInfo
fn clone(&self) -> HostedGitInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more