Macro toolforge::user_agent
source · macro_rules! user_agent { ( $tool:expr ) => { ... }; ( $tool:expr, $url:expr ) => { ... }; ( $tool:expr, $url:expr, $email:expr ) => { ... }; }
Expand description
Generates a Tool-specific User-Agent
header in compliance with
Wikimedia’s User-Agent policy.
The first and only required parameter is the tool’s name. Optional second
and third parameters can be overrides to the url and email, respectively.
Example
const USER_AGENT: &str = toolforge::user_agent!("mycooltool");
assert_eq!(
USER_AGENT,
"https://mycooltool.toolforge.org/ tools.mycooltool@toolforge.org"
);