Skip to main content

runi_core/
lib.rs

1//! Runi core library.
2//!
3//! `runi-core` hosts the foundation types shared across the Runi
4//! workspace (`Error`, `Result`, `Config`, `str_util`) and also acts as
5//! a feature-gated bundle that re-exports the other Runi sub-crates so
6//! most callers only need a single dependency.
7//!
8//! ## Recommended: alias to `runi`
9//!
10//! The plain `runi` name on crates.io is held by an unrelated project,
11//! so this crate ships as `runi-core`. Cargo lets each consumer rename
12//! a dependency at the call site with the `package` key, which gives
13//! you the clean `runi::` namespace without waiting on a name
14//! transfer:
15//!
16//! ```toml
17//! [dependencies]
18//! runi = { package = "runi-core", version = "0.1" }                          # + logging (default)
19//! runi = { package = "runi-core", version = "0.1", features = ["cli"] }     # + cli helpers
20//! runi = { package = "runi-core", version = "0.1", default-features = false } # foundation only
21//! ```
22//!
23//! ```ignore
24//! use runi::{Error, Result};
25//! use runi::log;
26//! use runi::cli::Tint;
27//! ```
28//!
29//! If you prefer, you can also depend on `runi-core` directly and
30//! import as `runi_core::…`.
31//!
32//! ## Bundle layout
33//!
34//! - [`runi_log`] is re-exported as [`log`] when the `log` feature is
35//!   enabled (on by default).
36//! - [`runi_cli`] is re-exported as [`cli`] when the `cli` feature is
37//!   enabled.
38//!
39//! The bundle role follows the pattern from
40//! [`wvlet/uni`](https://github.com/wvlet/uni).
41
42pub mod config;
43pub mod error;
44pub mod str_util;
45
46pub use config::Config;
47pub use error::{Error, Result};
48
49#[cfg(feature = "log")]
50pub use runi_log as log;
51
52#[cfg(feature = "cli")]
53pub use runi_cli as cli;