diff src/_doc.rs @ 146:1bc52025156b

Split PAM items into their own separate struct. To trim down the number of methods on `PamShared`, this puts all the Items into their own struct(s). This also makes the split between authtok/authtok_item easier to understand.
author Paul Fisher <paul@pfish.zone>
date Sun, 06 Jul 2025 19:10:26 -0400
parents 5c1e315c18ff
children
line wrap: on
line diff
--- a/src/_doc.rs	Sun Jul 06 19:04:57 2025 -0400
+++ b/src/_doc.rs	Sun Jul 06 19:10:26 2025 -0400
@@ -7,7 +7,7 @@
 /// # Examples
 ///
 /// ```ignore
-/// # use nonstick::{linklist, stdlinks};
+/// # use nonstick::_doc::{linklist, stdlinks};
 /// /// Here is a list of links:
 /// ///
 /// #[doc = linklist!(pam_get_authtok: man7, manbsd)]
@@ -21,34 +21,34 @@
     ($func:ident: adg$(, $rest:ident)*) => {
         concat!(
             "- [Application Developers' Guide on `", stringify!($func), "`][adg]\n",
-            $crate::linklist!($func: $($rest),*)
+            $crate::_doc::linklist!($func: $($rest),*)
         )
     };
     ($func:ident: mwg$(, $rest:ident)*) => {
         concat!(
             "- [Module Writers' Guide on `", stringify!($func), "`][mwg]\n",
-            $crate::linklist!($func: $($rest),*)
+            $crate::_doc::linklist!($func: $($rest),*)
         )
     };
     ($func:ident: _std$(, $rest:ident)*) => {
-        $crate::linklist!($func: man7, manbsd, xsso$(, $rest)*)
+        $crate::_doc::linklist!($func: man7, manbsd, xsso$(, $rest)*)
     };
     ($func:ident: man7$(, $rest:ident)*) => {
         concat!(
             "- [Linux-PAM manpage for `", stringify!($func), "`][man7]\n",
-            $crate::linklist!($func: $($rest),*)
+            $crate::_doc::linklist!($func: $($rest),*)
         )
     };
     ($func:ident: manbsd$(, $rest:ident)*) => {
         concat!(
             "- [OpenPAM manpage for `", stringify!($func), "`][manbsd]\n",
-            $crate::linklist!($func: $($rest),*)
+            $crate::_doc::linklist!($func: $($rest),*)
         )
     };
     ($func:ident: xsso$(, $rest:ident)*) => {
         concat!(
             "- [X/SSO spec for `", stringify!($func), "`][xsso]",
-            $crate::linklist!($func: $($rest),*)
+            $crate::_doc::linklist!($func: $($rest),*)
         )
     };
     ($func:ident:$(,)?) => { "" };
@@ -81,7 +81,7 @@
 /// # Examples
 ///
 /// ```ignore
-/// # use nonstick::man7;
+/// # use nonstick::_doc::man7;
 /// /// This contains a [link to the man page for malloc][man7].
 /// #[doc = man7!(3 malloc)]
 /// # fn do_whatever() {}
@@ -95,7 +95,7 @@
 /// ```
 macro_rules! man7 {
     ($n:literal $fn:ident $($anchor:literal)?) => {
-        $crate::man7!(man7: $n $fn $($anchor)?)
+        $crate::_doc::man7!(man7: $n $fn $($anchor)?)
     };
     ($name:ident: $n:literal $fn:ident $($anchor:literal)?) => {
         concat!(
@@ -111,7 +111,7 @@
 /// # Examples
 ///
 /// ```ignore
-/// # use nonstick::manbsd;
+/// # use nonstick::_doc::manbsd;
 /// // Both of these formulations create a link named `manbsd`.
 /// #[doc = manbsd!(3 fn_name)]
 /// #[doc = manbsd!(5 thing_name "SECTION")]
@@ -121,7 +121,7 @@
 /// ```
 macro_rules! manbsd {
     ($n:literal $func:ident $($anchor:literal)?) => {
-        $crate::manbsd!(manbsd: $n $func $($anchor)?)
+        $crate::_doc::manbsd!(manbsd: $n $func $($anchor)?)
     };
     ($name:ident: $n:literal $func:ident $($anchor:literal)?) => {
         concat!("[", stringify!($name), "]: ",
@@ -136,7 +136,7 @@
 /// # Examples
 ///
 /// ```ignore
-/// # use nonstick::xsso;
+/// # use nonstick::_doc::xsso;
 /// /// This docstring will [link to the X/SSO spec for `pam_set_item`][xsso].
 /// ///
 /// #[doc = xsso!(pam_set_item)]
@@ -150,8 +150,8 @@
 /// # fn do_whatever() {}
 /// ```
 macro_rules! xsso {
-    ($func:ident) => { $crate::xsso!(xsso: concat!(stringify!($func), ".htm")) };
-    ($page:literal) => { $crate::xsso!(xsso: $page) };
+    ($func:ident) => { $crate::_doc::xsso!(xsso: concat!(stringify!($func), ".htm")) };
+    ($page:literal) => { $crate::_doc::xsso!(xsso: $page) };
     ($name:ident: $page:expr) => {
         concat!("[", stringify!($name), "]: https://pubs.opengroup.org/onlinepubs/8329799/", $page)
     };
@@ -164,7 +164,7 @@
 /// # Examples
 ///
 /// ```ignore
-/// # use nonstick::stdlinks;
+/// # use nonstick::_doc::stdlinks;
 /// /// Check out [this][man7], [that][manbsd], or [the other][xsso].
 /// ///
 /// #[doc = stdlinks!(3 pam_get_item)]
@@ -172,7 +172,10 @@
 /// ```
 macro_rules! stdlinks {
     ($n:literal $func:ident) => {
-        concat!($crate::man7!($n $func), "\n", $crate::manbsd!($n $func), "\n", $crate::xsso!($func))
+        concat!(
+            $crate::_doc::man7!($n $func), "\n",
+            $crate::_doc::manbsd!($n $func), "\n",
+            $crate::_doc::xsso!($func))
     };
 }