pub struct SourceUrl {
pub url: Url,
pub vcs_info: Option<VcsInfo>,
}Expand description
A URL for package sources.
Wraps the Url type and provides optional information on VCS systems.
Can be created from custom URL strings, that in part resemble the default URL syntax, e.g.:
git+https://example.org/example-project.git#tag=v1.0.0?signedThe above example provides an overview of the custom URL syntax:
- The optional VCS specifier
gitis prepended, directly followed by a “+” sign as delimiter, - specific URL
fragmenttypes such astagare used to encode information about the particular VCS objects to address, - the URL
querycomponentsignedis used to indicate that OpenPGP signature verification is required for a VCS type.
§Note
The URL format used by SourceUrl deviates from the default URL syntax by allowing to
change the order of the query and fragment component!
Refer to the alpm-package-source documentation for a more detailed overview of the custom URL syntax.
§Examples
use std::str::FromStr;
use alpm_types::SourceUrl;
// Create Url from &str
let url =
SourceUrl::from_str("git+https://your-vcs.org/example-project.git?signed#tag=v1.0.0")?;
assert_eq!(
&url.to_string(),
"git+https://your-vcs.org/example-project.git?signed#tag=v1.0.0"
);Fields§
§url: UrlThe URL from where the sources are retrieved.
vcs_info: Option<VcsInfo>Optional data on VCS systems using the URL for the retrieval of sources.
Implementations§
Source§impl SourceUrl
impl SourceUrl
Sourcefn parser(input: &mut &str) -> ModalResult<SourceUrl>
fn parser(input: &mut &str) -> ModalResult<SourceUrl>
Parses a full SourceUrl from a string slice.
Sourcefn inner_url_parser(input: &mut &str) -> ModalResult<String>
fn inner_url_parser(input: &mut &str) -> ModalResult<String>
Recognizes a URL in an alpm-package-source string.
Considers all chars until a special char or the EOF is encountered:
#character that indicates a fragment?character indicates a queryEOFwe reached the end of the string.
All of the above indicate that the end of the URL has been reached.
The # or ? are not consumed, so that an outer parser may continue parsing afterwards.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SourceUrl
impl<'de> Deserialize<'de> for SourceUrl
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl FromStr for SourceUrl
impl FromStr for SourceUrl
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Creates a new SourceUrl instance from a string slice.
§Examples
use std::str::FromStr;
use alpm_types::SourceUrl;
let url =
SourceUrl::from_str("git+https://your-vcs.org/example-project.git?signed#tag=v1.0.0")?;
assert_eq!(
&url.to_string(),
"git+https://your-vcs.org/example-project.git?signed#tag=v1.0.0"
);