luhcore 0.0.1

the core library for the luh ecosystem
Documentation
  • Coverage
  • 82.19%
    60 out of 73 items documented5 out of 55 items with examples
  • Size
  • Source code size: 62.8 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.3 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 15s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • calizoots/luhcore
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • calizoots

luhcore

luhcore is a small utility crate providing core functionality commonly needed in my applications, including:

  • Terminal styling via [Colorise], [Style], [StyledText], and [Color].
  • Platform directories handling via [dirs::AppDirs].
  • Build and environment checks like is_ci(), is_debug_build(), and is_release_build().

Modules

  • [color]: Extension trait for coloring strings and styled text.
  • [style]: Core style types (Style, StyledText, Color) and styling logic.
  • [dirs]: Application directories handling (AppDirs) for config, cache, temp files, etc.

Features

  • Terminal text styling
    Apply foreground/background colors, bold, underline, and dim effects using a convenient trait interface.

  • Environment detection
    Check if running in a CI environment, or whether the build is a debug or release build.

  • Cross-platform directories
    Create and manage app-specific config, cache, and temporary directories, including development temp files.

Examples

Terminal styling

use luhcore::Colorise;

println!("{}", "error".red().bold());
println!("{}", "warning".yellow().underline());
println!("{}", "success".green().on_white().dim());

Environment detection

use luhcore::{is_ci, is_debug_build};

if is_ci() {
    println!("Running in CI environment");
}
if is_debug_build() {
    println!("Running in debug mode");
}

Directories handling

use luhcore::dirs::AppDirs;

fn main() -> std::io::Result<()> {
    let dirs = AppDirs::for_app("luhcore")?;
    dirs.ensure_all()?;

    println!("Config dir: {}", dirs.config.display());
    println!("Cache dir:  {}", dirs.cache.display());
    println!("Temp dir:   {}", dirs.temp.display());

    let temp_file = dirs.dev_temp_file("example.txt");
    println!("Development temp file path: {}", temp_file.display());

    Ok(())
}

Note

made with love s.c 2025 :)