Skip to content

anthonysgro/nano

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“¦ Nano

Minimal, (mostly) zero-dependency Rust crates for focused applications.

A collection of tiny, focused Rust crates built on the standard library alone. Each one does one thing well and keeps its dependency count at zero. The one exception is nanologger, whose only dependencies are two other nano crates β€” nanocolor and nanotime β€” keeping the family entirely self-contained. nanoargs also optionally depends on nanocolor for colored help output via a cargo feature.

Crates

Crate Description Version GitHub Coverage
πŸ“Ž nanoargs Argument parser crates.io Repo Coverage
πŸͺ΅ nanologger Colored, leveled logger crates.io Repo Coverage
🎨 nanocolor Terminal colors and styles crates.io Repo Coverage
β–‘ nanoprogress Progress bars crates.io Repo Coverage
β ‹ nanospinner Terminal spinners crates.io Repo Coverage
⏱ nanotime Time utilities crates.io Repo Coverage

πŸ“Ž nanoargs

Build Status Crates.io Docs.rs Coverage Status License

A lightweight, zero-dependency argument parser for Rust

GitHub Β· crates.io Β· docs.rs

Flags, options, subcommands, help generation, env fallback, and typed parsing β€” everything you'd reach for clap for in a typical CLI, with zero dependencies.

Install:

cargo add nanoargs

Dependencies: 0 (only std; optional color feature adds nanocolor)

use nanoargs::{ArgBuilder, Flag, Opt, Pos, ParseError};

fn main() {
    let parser = ArgBuilder::new()
        .name("myapp")
        .description("A sample CLI tool")
        .flag(Flag::new("verbose").desc("Enable verbose output").short('v'))
        .option(Opt::new("output").placeholder("FILE").desc("Output file path"))
        .positional(Pos::new("input").desc("Input file").required())
        .build()
        .unwrap();

    let args: Vec<String> = std::env::args().skip(1).collect();

    match parser.parse(args) {
        Ok(result) => {
            println!("verbose: {}", result.get_flag("verbose"));
            println!("output:  {:?}", result.get_option("output"));
            println!("input:   {:?}", result.get_positionals());
        }
        Err(ParseError::HelpRequested(text)) => print!("{}", text),
        Err(ParseError::VersionRequested(text)) => println!("{}", text),
        Err(e) => eprintln!("error: {}", e),
    }
}

πŸͺ΅ nanologger

Build Status Crates.io Docs.rs Coverage Status License

A minimal logger for Rust.

GitHub Β· crates.io Β· docs.rs

Colored, leveled logging to stderr with format!-style macros, optional timestamps, source locations, thread info, module filtering, file logging, and log facade integration.

Install:

cargo add nanologger

Dependencies: 2 β€” nanocolor and nanotime (both nano family crates)

⚠️ nanologger is the only crate in the family that is not zero-dependency. Its only dependencies are two other nano crates, keeping the family self-contained.

use nanologger::{LoggerBuilder, LogLevel};

fn main() {
    LoggerBuilder::new()
        .level(LogLevel::Trace)
        .timestamps(true)
        .init()
        .unwrap();

    nanologger::error!("something went wrong: {}", "disk full");
    nanologger::warn!("retries remaining: {}", 3);
    nanologger::info!("server started on port {}", 8080);
}

🎨 nanocolor

Build Status Crates.io Docs.rs Coverage Status License

A minimal, zero-dependency terminal color and text styling crate for Rust

GitHub Β· crates.io Β· docs.rs

ANSI 16-color support and common text styles through a chainable trait-based API β€” under 300 lines of code.

Install:

cargo add nanocolor

Dependencies: 0 (only std)

use nanocolor::Colorize;

fn main() {
    println!("{}", "error".red().bold());
    println!("{}", "warning".yellow());
    println!("{}", "success".green().on_black().underline());
}

β–ˆβ–ˆβ–‘β–‘ nanoprogress

Build Status Crates.io Docs.rs Coverage Status License

A minimal, zero-dependency terminal progress bar for Rust applications

GitHub Β· crates.io Β· docs.rs

Lightweight determinate progress bar β€” under 300 lines of code. Thread-safe, customizable width/fill/empty chars.

Install:

cargo add nanoprogress

Dependencies: 0 (only std)

use nanoprogress::ProgressBar;
use std::thread;
use std::time::Duration;

fn main() {
    let bar = ProgressBar::new(100)
        .message("Downloading...")
        .start();

    for _ in 0..100 {
        thread::sleep(Duration::from_millis(30));
        bar.tick(1);
    }
    bar.success("Download complete");
}

β ‹ nanospinner

Build Status Crates.io Docs.rs Coverage Status License

A minimal, zero-dependency terminal spinner for Rust applications

GitHub Β· crates.io Β· docs.rs

Lightweight animated spinner using only the Rust standard library β€” under 200 lines of code.

Install:

cargo add nanospinner

Dependencies: 0 (only std)

use nanospinner::Spinner;
use std::thread;
use std::time::Duration;

fn main() {
    let handle = Spinner::new("Loading...").start();
    thread::sleep(Duration::from_secs(2));
    handle.success();
}

⏱ nanotime

Build Status Crates.io Docs.rs Coverage Status License

A minimal, zero-dependency time utility crate for Rust applications

GitHub Β· crates.io Β· docs.rs

Local and UTC time retrieval, nanosecond-precision timestamps, human-readable formatting, relative time strings, and lightweight elapsed duration measurement.

Install:

cargo add nanotime

Dependencies: 0 (only std + raw FFI)

use nanotime::{NanoTime, Elapsed};

fn main() {
    let now = NanoTime::now();
    println!("Local time: {}", now);
    println!("UTC: {}", NanoTime::now_utc().datetime());

    let timer = Elapsed::start();
    // ... do some work ...
    println!("Took {}", timer);
}

Using Multiple Nano Crates

[dependencies]
nanoargs = "0.1"
nanologger = "0.1"
nanocolor = "0.1"
nanoprogress = "0.1"
nanospinner = "0.1"
nanotime = "0.1"

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines on reporting issues, suggesting new crates, and contributing to existing ones.

License

This project is licensed under the MIT License β€” see the LICENSE file for details.

About

πŸ“¦ nano β€” A collection of small, focused Rust crates built on the standard library alone. Each one does one thing well and keeps its third-party dependency count at zero.

Resources

License

Contributing

Stars

Watchers

Forks

Contributors