GitUrl

Struct GitUrl 

Source
pub struct GitUrl<'url> { /* private fields */ }
Expand description

Represents a parsed Git repository url

GitUrl is an input url used by git. Parsing of the url inspired by rfc3986, but does not strictly cover the spec Optional, but by default, uses the url crate to perform a final validation of the parsing effort

Implementations§

Source§

impl<'url> GitUrl<'url>

Source

pub fn scheme(&self) -> Option<&'url str>

scheme name (i.e. scheme://)

Source

pub fn user(&self) -> Option<&'url str>

user name userinfo

Source

pub fn password(&self) -> Option<&'url str>

password userinfo provided with user (i.e. user:password@…)

Source

pub fn host(&self) -> Option<&'url str>

The hostname or IP of the repo host

Source

pub fn port(&self) -> Option<u16>

The port number of the repo host, if specified

Source

pub fn path(&self) -> &'url str

File or network path to repo

Source

pub fn print_scheme(&self) -> bool

If we should print scheme:// from input or derived during parsing

Source§

impl<'url> GitUrl<'url>

Source

pub fn trim_auth(&self) -> GitUrl<'_>

Returns GitUrl after removing all user info values

Source

pub fn parse(input: &'url str) -> Result<Self, GitUrlParseError>

Returns a Result<GitUrl> after parsing input for metadata

let http_url = GitUrl::parse("https://github.com/tjtelan/git-url-parse-rs.git")?;
let ssh_url = GitUrl::parse("git@github.com:tjtelan/git-url-parse-rs.git")?;
Source

pub fn provider_info<T>(&self) -> Result<T, GitUrlParseError>

use git_url_parse::GitUrl;
use git_url_parse::types::provider::GenericProvider;

let ssh_url = GitUrl::parse("git@github.com:tjtelan/git-url-parse-rs.git")?;
let provider : GenericProvider = ssh_url.provider_info()?;

Trait Implementations§

Source§

impl<'url> Clone for GitUrl<'url>

Source§

fn clone(&self) -> GitUrl<'url>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'url> Debug for GitUrl<'url>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'url> Default for GitUrl<'url>

Source§

fn default() -> GitUrl<'url>

Returns the “default value” for a type. Read more
Source§

impl Display for GitUrl<'_>

Build the printable GitUrl from its components

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> GitProvider<GitUrl<'a>, GitUrlParseError> for AzureDevOpsProvider<'a>

Source§

fn from_git_url(url: &GitUrl<'a>) -> Result<Self, GitUrlParseError>

Trait method called by GitUrl::provider_info() Read more
Source§

impl<'a> GitProvider<GitUrl<'a>, GitUrlParseError> for GenericProvider<'a>

Source§

fn from_git_url(url: &GitUrl<'a>) -> Result<Self, GitUrlParseError>

Trait method called by GitUrl::provider_info() Read more
Source§

impl<'a> GitProvider<GitUrl<'a>, GitUrlParseError> for GitLabProvider<'a>

Source§

fn from_git_url(url: &GitUrl<'a>) -> Result<Self, GitUrlParseError>

Trait method called by GitUrl::provider_info() Read more
Source§

impl<'url> PartialEq for GitUrl<'url>

Source§

fn eq(&self, other: &GitUrl<'url>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'url> TryFrom<&GitUrl<'url>> for Url

Source§

type Error = ParseError

The type returned in the event of a conversion error.
Source§

fn try_from(value: &GitUrl<'_>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'url> TryFrom<GitUrl<'url>> for Url

Source§

type Error = ParseError

The type returned in the event of a conversion error.
Source§

fn try_from(value: GitUrl<'_>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'url> Eq for GitUrl<'url>

Source§

impl<'url> StructuralPartialEq for GitUrl<'url>

Auto Trait Implementations§

§

impl<'url> Freeze for GitUrl<'url>

§

impl<'url> RefUnwindSafe for GitUrl<'url>

§

impl<'url> Send for GitUrl<'url>

§

impl<'url> Sync for GitUrl<'url>

§

impl<'url> Unpin for GitUrl<'url>

§

impl<'url> UnwindSafe for GitUrl<'url>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,