pub struct Url {
pub scheme: Scheme,
pub port: Option<u16>,
pub path: BString,
/* private fields */
}
Expand description
A URL with support for specialized git related capabilities.
Additionally there is support for deserialization and serialization
(see the Display::fmt()
implementation).
§Deviation
Note that we do not support passing the password using the URL as it’s likely leading to accidents.
Fields§
§scheme: Scheme
The URL scheme.
port: Option<u16>
The port to use when connecting to a host. If None
, standard ports depending on scheme
will be used.
path: BString
The path portion of the URL, usually the location of the git repository.
Implementations§
Source§impl Url
Instantiation
impl Url
Instantiation
Source§impl Url
Builder
impl Url
Builder
Sourcepub fn serialize_alternate_form(self, use_alternate_form: bool) -> Self
pub fn serialize_alternate_form(self, use_alternate_form: bool) -> Self
Enable alternate serialization for this url, e.g. file:///path
becomes /path
.
This is automatically set correctly for parsed URLs, but can be set here for urls created by constructor.
Sourcepub fn canonicalize(&mut self) -> Result<(), Error>
pub fn canonicalize(&mut self) -> Result<(), Error>
Turn a file url like file://relative
into file:///root/relative
, hence it assures the url’s path component is absolute.
Source§impl Url
Access
impl Url
Access
Sourcepub fn path_is_root(&self) -> bool
pub fn path_is_root(&self) -> bool
Returns true if the path portion of the url is /
.
Sourcepub fn port_or_default(&self) -> Option<u16>
pub fn port_or_default(&self) -> Option<u16>
Returns the actual or default port for use according to the url scheme. Note that there may be no default port either.
Source§impl Url
Transformation
impl Url
Transformation
Sourcepub fn canonicalized(&self) -> Result<Self, Error>
pub fn canonicalized(&self) -> Result<Self, Error>
Turn a file url like file://relative
into file:///root/relative
, hence it assures the url’s path component is absolute.