Skip to main content

tools

Macro tools 

Source
macro_rules! tools {
    (
        $(
            $(#[doc = $summary:literal])+
            $name:ident => $params:ty, $handler:path,
                toolset: $toolset:ident,
                tier: $tier:ident
                $(, idempotent: $idempotent:literal)?
                $(, confirm: $confirm:literal)?
                $(, severing: $severing:literal)?
                $(, severs_local: $severs_local:literal)?
                $(, varying: $varying:literal)?
                $(, since: $since:literal)?
                $(, platforms: [$($platform:literal),+ $(,)?])?
                $(,)?
            ;
        )*
    ) => { ... };
}
Expand description

Declare tools.

One block per toolset module; one entry per tool. The entry names its parameter type and its handler, and states its toolset and tier — omit either and this does not compile, which is the point.

ⓘ
tools! {
    /// Report the state of the local node and the peers it knows about.
    tailscale_status => StatusParams, handlers::status,
        toolset: LocalStatus, tier: Read, idempotent: true;
}

Optional trailing settings, each defaulting to the safe answer: idempotent (false), confirm (false), severing (false, and implies confirm), severs_local (false, and requires a confirm parameter), varying (false), since (no minimum version).