Skip to main content

Crate tiny_update_check

Crate tiny_update_check 

Source
Expand description

§tiny-update-check

A minimal, lightweight crate update checker for Rust CLI applications.

This crate provides a simple way to check if a newer version of your crate is available on crates.io, with built-in caching to avoid excessive API requests.

§Features

  • Minimal dependencies: Only ureq and semver
  • Small binary impact: ~0.5MB with native-tls (vs ~1.4MB for alternatives)
  • Simple file-based caching: Configurable cache duration (default: 24 hours)
  • TLS flexibility: Choose native-tls (default) or rustls

§Quick Start

use tiny_update_check::UpdateChecker;

let checker = UpdateChecker::new("my-crate", "1.0.0");
if let Ok(Some(update)) = checker.check() {
    eprintln!("Update available: {} -> {}", update.current, update.latest);
}

§With Custom Configuration

use tiny_update_check::UpdateChecker;
use std::time::Duration;

let checker = UpdateChecker::new("my-crate", "1.0.0")
    .cache_duration(Duration::from_secs(60 * 60)) // 1 hour
    .timeout(Duration::from_secs(10));

if let Ok(Some(update)) = checker.check() {
    eprintln!("New version {} released!", update.latest);
}

§Feature Flags

  • native-tls (default): Uses system TLS, smaller binary size
  • rustls: Pure Rust TLS, better for cross-compilation

Structs§

UpdateChecker
A lightweight update checker for crates.io.
UpdateInfo
Information about an available update.

Enums§

Error
Errors that can occur during update checking.

Functions§

check
Convenience function to check for updates with default settings.