Mercurial > crates > nonstick
diff src/_doc.rs @ 171:e27c5c667a5a
Create full new types for return code and flags, separate end to end.
This plumbs the ReturnCode and RawFlags types through the places where
we call into or are called from PAM.
Also adds Sun documentation to the project.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Fri, 25 Jul 2025 20:52:14 -0400 |
parents | 1bc52025156b |
children | 9e4ce1631bd3 |
line wrap: on
line diff
--- a/src/_doc.rs Wed Jul 16 18:45:20 2025 -0400 +++ b/src/_doc.rs Fri Jul 25 20:52:14 2025 -0400 @@ -31,7 +31,7 @@ ) }; ($func:ident: _std$(, $rest:ident)*) => { - $crate::_doc::linklist!($func: man7, manbsd, xsso$(, $rest)*) + $crate::_doc::linklist!($func: man7, manbsd, mansun, xsso$(, $rest)*) }; ($func:ident: man7$(, $rest:ident)*) => { concat!( @@ -45,6 +45,12 @@ $crate::_doc::linklist!($func: $($rest),*) ) }; + ($func:ident: mansun$(, $rest:ident)*) => { + concat!( + "- [Illumos manpage for `", stringify!($func), "`][mansun]\n", + $crate::_doc::linklist!($func: $($rest),*) + ) + }; ($func:ident: xsso$(, $rest:ident)*) => { concat!( "- [X/SSO spec for `", stringify!($func), "`][xsso]", @@ -131,6 +137,40 @@ }; } +/// Generates a Markdown link reference to the SmartOS man pages. +/// +/// # Examples +/// +/// ```ignore +/// # use nonstick::_doc::mansun; +/// // Both of these formulations create a link named `manbsd`. +/// #[doc = mansun!(3pam fn_name)] +/// #[doc = mansun!(5 "a.out" "synopsis")] +/// // This one creates a link named `link_name`. +/// #[doc = mansun!(link_name: 1 alias "examples")] +/// # fn do_whatever() {} +/// ``` +macro_rules! mansun { + ($n:literal $func:ident $($anchor:literal)?) => { + $crate::_doc::mansun!(mansun: [$n ""] $func $($anchor)?) + }; + ([$n:literal $sect:literal] $func:ident $($anchor:literal)?) => { + $crate::_doc::mansun!(mansun: [$n $sect] $func $($anchor)?) + }; + ($name:ident: $n:literal $func:ident $($anchor:literal)?) => { + $crate::_doc::mansun!($name: [$n ""] $func $($anchor)?) + }; + ($name:ident: [$n:literal $sect:literal] $func:ident $($anchor:literal)?) => { + $crate::_doc::mansun!($name: [$n $sect] (stringify!($func)) $($anchor)?) + }; + ($name:ident: [$n:literal $sect:literal] ($func:expr) $($anchor:literal)?) => { + concat!("[", stringify!($name), "]: ", + "https://smartos.org/man/", $n, $sect, "/", $func, + $("#", $anchor)? + ) + }; +} + /// Generates a Markdown link reference to the X/SSO specification. /// /// # Examples @@ -175,8 +215,9 @@ concat!( $crate::_doc::man7!($n $func), "\n", $crate::_doc::manbsd!($n $func), "\n", + $crate::_doc::mansun!([$n "pam"] $func), "\n", $crate::_doc::xsso!($func)) }; } -pub(crate) use {guide, linklist, man7, manbsd, stdlinks, xsso}; +pub(crate) use {guide, linklist, man7, manbsd, mansun, stdlinks, xsso};