Crate self_update [] [src]

Build Status crates.io:clin docs

self_update provides updaters for updating rust executables in-place from various release distribution backends.

Currently only GitHub releases are supported.

self_update = "0.2"

Usage

Update (replace) the current executable with the latest release downloaded from https://api.github.com/repos/jaemk/self_update/releases/latest

#[macro_use] extern crate self_update;

fn update() -> Result<(), Box<::std::error::Error>> {
    let target = self_update::get_target()?;
    let status = self_update::backends::github::Updater::configure()?
        .repo_owner("jaemk")
        .repo_name("self_update")
        .target(&target)
        .bin_name("self_update_example")
        .show_download_progress(true)
        .current_version(cargo_crate_version!())
        .build()?
        .update()?;
    println!("Update status: `v{}`!", status.version());
    Ok(())
}

Run the above example to see self_update in action: cargo run --example github

Modules

backends

Collection of modules supporting various release distribution backends

errors

Error type, conversions, and macros

macros

Macros

cargo_crate_version

Allows you to pull the version from your Cargo.toml at compile time as MAJOR.MINOR.PATCH_PKGVERSION_PRE

Enums

Status

Status returned after updating

Functions

get_target

Try to determine the current target triple.