Struct compose_yml::v2::GitUrl
[−]
[src]
pub struct GitUrl { /* fields omitted */ }
URL of a Git repository. Git repositories may be specified as either
ordinary http
or https
URLs, or as scp
-style remote directory
specifiers.
One of the goals behind this class is to be able to use it as an
"enhanced string", much like PathBuf
, that can be passed to various
APIs using conversion via AsRef
and From
. So we implement plenty
of conversions, plus Ord
so we can be used as a key in a BTreeMap
.
Methods
impl GitUrl
[src]
pub fn should_treat_as_url<S: AsRef<str>>(s: S) -> bool
[src]
Would docker-compose
interpret this string as a URL? We check
against a list of known prefixes that trigger URL intepretation in
docker-compose
.
pub fn new<S: Into<String>>(url: S) -> Result<GitUrl>
[src]
Create a GitUrl
from the specified string. Will only return an
error if should_treat_as_url
returns false.
pub fn to_url(&self) -> Result<Url>
[src]
Convert a GitUrl
to a regular url::Url
object.
pub fn without_subdirectory(&self) -> GitUrl
[src]
Returns a new GitUrl which is the same as the this one, but without any subdirectory part
pub fn repository(&self) -> &str
[src]
Extract the repository part of the URL
pub fn branch(&self) -> Option<&str>
[src]
Extract the optional branch part of the git URL
pub fn subdirectory(&self) -> Option<&str>
[src]
Extract the optional subdirectory part of the git URL
Trait Implementations
impl Debug for GitUrl
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Clone for GitUrl
[src]
fn clone(&self) -> GitUrl
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq for GitUrl
[src]
fn eq(&self, __arg_0: &GitUrl) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &GitUrl) -> bool
[src]
This method tests for !=
.
impl Eq for GitUrl
[src]
impl PartialOrd for GitUrl
[src]
fn partial_cmp(&self, __arg_0: &GitUrl) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &GitUrl) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &GitUrl) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &GitUrl) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &GitUrl) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for GitUrl
[src]
fn cmp(&self, __arg_0: &GitUrl) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
impl Display for GitUrl
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl AsRef<str> for GitUrl
[src]
impl AsRef<OsStr> for GitUrl
[src]
Convert to an &OsStr
, which makes it easier to use APIs like
std::process::Command
that take AsRef<OsStr>
for their arguments.