[][src]Macro toolforge::user_agent

macro_rules! user_agent {
    ( $tool:expr ) => { ... };
    ( $tool:expr, $url:expr ) => { ... };
    ( $tool:expr, $url:expr, $email:expr ) => { ... };
}

Macro to generate 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

assert_eq!(
    user_agent!("mycooltool"),
    "https://mycooltool.toolforge.org/ tools.mycooltool@tools.wmflabs.org"
);