Merge branch 'master' into url_macros_to_the_rescue
All checks were successful
Run Check Script / check (pull_request) Successful in 1m6s
All checks were successful
Run Check Script / check (pull_request) Successful in 1m6s
This commit is contained in:
@@ -155,24 +155,24 @@ pub fn cidrv4(input: TokenStream) -> TokenStream {
|
||||
///
|
||||
/// ```
|
||||
/// use harmony_types::net::Url;
|
||||
/// use harmony_macros::remote_url;
|
||||
/// use harmony_macros::hurl;
|
||||
///
|
||||
/// let remote_url = remote_url!("https://example.com/path");
|
||||
/// let url = hurl!("https://example.com/path");
|
||||
///
|
||||
/// let expected_url = url::Url::parse("https://example.com/path").unwrap();
|
||||
/// assert!(matches!(remote_url, Url::Url(expected_url)));
|
||||
/// assert!(matches!(url, Url::Url(expected_url)));
|
||||
/// ```
|
||||
///
|
||||
/// The following example will fail to compile:
|
||||
///
|
||||
/// ```rust,compile_fail
|
||||
/// use harmony_macros::remote_url;
|
||||
/// use harmony_macros::hurl;
|
||||
///
|
||||
/// // This is not a valid URL and will cause a compilation error.
|
||||
/// let _invalid = remote_url!("not a valid url");
|
||||
/// let _invalid = hurl!("not a valid url");
|
||||
/// ```
|
||||
#[proc_macro]
|
||||
pub fn remote_url(input: TokenStream) -> TokenStream {
|
||||
pub fn hurl(input: TokenStream) -> TokenStream {
|
||||
let input_lit = parse_macro_input!(input as LitStr);
|
||||
let url_str = input_lit.value();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user