Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Diagnosticism.Rust - CHANGES <!-- omit in toc -->


## 0.3.1 - 28th June 2026

* internal implementation improvements;


## 0.3.0 - 27th June 2026

* added `nanoseconds_to_string()` — compact human-readable duration formatting (behaviour matches **Diagnosticism.Python** 0.16.0);
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ name = "diagnosticism"
readme = "README.md"
repository = "https://github.com/synesissoftware/Diagnosticism.Rust"
rust-version = "1.74"
version = "0.3.0"
version = "0.3.1"


# ##########################################################
Expand Down
10 changes: 1 addition & 9 deletions src/diagnostics/mod.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
// diagnostics/mod.rs

macro_rules! declare_and_publish {
($mod_name:ident, $($type_name:ident),* $(,)?) => {
mod $mod_name;

pub use $mod_name::{
$($type_name),*
};
};
}
use crate::macros::declare_and_publish;

declare_and_publish!(debug_squeezer, DebugSqueezer);
declare_and_publish!(doomgram, DoomGram, doom_scope);
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
// lib.rs

pub mod diagnostics;
pub(crate) mod macros;

pub use diagnostics::{
doom_scope,
Expand Down
109 changes: 109 additions & 0 deletions src/macros.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
macro_rules! declare_and_publish_impl_ {
($mod_name:ident; $($construct_name:ident),*; $vis:vis) => {
mod $mod_name;

$vis use $mod_name::{ $($construct_name),* };
};
}

/// Declares a private submodule and re-exports selected items from it.
///
/// Use in a **`mod.rs` barrel file** when a directory contains sibling
/// `.rs` implementation files. Each invocation replaces:
///
/// ```rust,ignore
/// mod margin;
/// pub use margin::margin;
/// ```
///
/// with a single macro call. The first argument is the **module name**
/// (matching `name.rs` or `name/mod.rs`); remaining arguments are **item
/// names** (types, functions, constants) to re-export from that module.
///
/// # Setup
///
/// ```rust,ignore
/// use crate::macros::declare_and_publish;
/// ```
///
/// # Forms
///
/// * `declare_and_publish!(mod_name, Item)` — `pub use` (default);
/// * `declare_and_publish!(pub mod_name, Item)` — `pub use` (explicit);
/// * `declare_and_publish!(crate mod_name, Item)` — `pub(crate) use`;
/// * `declare_and_publish!(super mod_name, Item)` — `pub(super) use`;
/// * `declare_and_publish!(self mod_name, Item)` — `pub(self) use`;
/// * `declare_and_publish!(priv mod_name, Item)` — `pub(self) use`
/// (synonym);
/// * `declare_and_publish!($vis mod_name, Item)` — any Rust visibility
/// (e.g. `pub(crate)`, `pub(in crate::api)`).
///
/// Multiple items may be re-exported from one module:
///
/// ```rust,ignore
/// declare_and_publish!(doomgram, DoomGram, doom_scope);
/// ```
///
/// A parent module (including **`lib.rs`**) may aggregate a child barrel:
///
/// ```rust,ignore
/// declare_and_publish!(
/// api,
/// evaluate_scalar_eq_approx,
/// margin,
/// );
/// ```
///
/// # Examples
///
/// Public API surface:
///
/// ```rust,ignore
/// declare_and_publish!(password, Password);
/// declare_and_publish!(
/// time_format,
/// NanosecondsStr,
/// nanoseconds_to_string,
/// );
/// ```
///
/// Crate-internal wiring:
///
/// ```rust,ignore
/// declare_and_publish!(crate compare, compare_foo, compare_bar);
/// ```
///
/// Submodules that need no re-export remain ordinary private declarations:
///
/// ```rust,ignore
/// mod flf;
/// ```
macro_rules! declare_and_publish {
(crate $mod_name:ident $(, $construct_name:ident)* $(,)?) => {
$crate::macros::declare_and_publish_impl_!($mod_name; $($construct_name),*; pub(crate));
};
(pub $mod_name:ident $(, $construct_name:ident)* $(,)?) => {
$crate::macros::declare_and_publish_impl_!($mod_name; $($construct_name),*; pub);
};
(priv $mod_name:ident $(, $construct_name:ident)* $(,)?) => {
$crate::macros::declare_and_publish_impl_!($mod_name; $($construct_name),*; pub(self));
};
(self $mod_name:ident $(, $construct_name:ident)* $(,)?) => {
$crate::macros::declare_and_publish_impl_!($mod_name; $($construct_name),*; pub(self));
};
(super $mod_name:ident $(, $construct_name:ident)* $(,)?) => {
$crate::macros::declare_and_publish_impl_!($mod_name; $($construct_name),*; pub(super));
};
($mod_name:ident $(, $construct_name:ident)* $(,)?) => {
$crate::macros::declare_and_publish_impl_!($mod_name; $($construct_name),*; pub);
};
($vis:vis $mod_name:ident $(, $construct_name:ident)* $(,)?) => {
$crate::macros::declare_and_publish_impl_!($mod_name; $($construct_name),*; $vis);
};
}

pub(crate) use declare_and_publish;
pub(crate) use declare_and_publish_impl_;


// ///////////////////////////// end of file //////////////////////////// //
Loading