ib-update 0.1.0

A lightweight library for software update
Documentation
/*!
A lightweight library for software update.

Features:
- Lightweight
  - Based on [`nyquest`](https://github.com/bdbai/nyquest),
    can use either platform-native HTTP client or `reqwest`.
  - 333 KiB on `x86_64-pc-windows-msvc` with HTTPS update checking.
- Supported update sources:
  - GitHub Releases
- [Semantic Versioning](https://semver.org) handling.
  - Optional pre-release update.
- Provide both sync/async APIs.
- Optional support for retrying multiple servers under unstable networks.

## Blocking API
Use [`UpdateConfig::builder`](github::UpdateConfig::builder) and [`build_blocking`](github::UpdateConfigBuilder::build_blocking).
Make sure an nyquest backend is registered before making requests:

```no_run
// cargo add ib-update --features blocking
// cargo add nyquest-preset --features blocking
fn main() {
    nyquest_preset::register();

    let info = ib_update::github::UpdateConfig::builder()
        .owner("owner")
        .repo("repo")
        .current_version(env!("CARGO_PKG_VERSION"))
        .build_blocking()
        .check()
        .expect("failed to check for updates");

    if info.has_update() {
        println!("New version {} is available!", info.latest().tag);
    }
}
```

## Async API
Use [`UpdateConfig::builder`](github::UpdateConfig::builder) and [`build_async`](github::UpdateConfigBuilder::build_async).
Make sure an nyquest backend is registered before making requests:

```no_run
// cargo add ib-update --features async
// cargo add nyquest-preset --features blocking
fn main() {
    nyquest_preset::register();

    futures::executor::block_on(async {
        let info = ib_update::github::UpdateConfig::builder()
            .owner("owner")
            .repo("repo")
            .current_version(env!("CARGO_PKG_VERSION"))
            .build_async()
            .check()
            .await
            .expect("failed to check for updates");

        if info.has_update() {
            println!("New version {} is available!", info.latest().tag);
        }
    });
}
```

## Binary size
The following `Cargo.toml` settings are recommended if small binary size is desired:
```toml
[profile.release]
lto = "fat"
codegen-units = 1

strip = true
```
These can reduce the size by ~50 KiB on `x86_64-pc-windows-msvc`.

## Crate features
*/
#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(feature = "doc", doc = document_features::document_features!())]

mod git;
pub mod github;
mod http;

/// Re-export of the `semver` crate for users who want to construct or compare
/// version strings independently.
pub use semver;

#[cfg(test)]
mod tests {
    /// auto-register
    // #[allow(unused)]
    // use nyquest_preset;

    #[ctor::ctor(unsafe)]
    fn auto_register() {
        nyquest_preset::register();
    }
}