Crate update_me

source ·
Expand description

crates.io:clin docs update_me provides functionality to implement a self-updating Rust executable.

The executable can update itself by replacing the current executing file with a newer version.

This library only implements the updating mechanism itself, thereby providing full flexibility to implement different release distribution backends.

Example of updating from a file:

use update_me;
use std::fs::File;
use std::io::Read;
use anyhow::Result;

pub fn update(path: &String) -> Result<()> {
    let mut file = File::open(path)?;
    let mut data: Vec<u8> = Vec::new();
    file.read_to_end(&mut data)?;

    update_me::apply(&mut data)?;

    Ok(())
}

Functions