pub trait ReleaseUpdate: UpdateConfig + UpdateInternals {
// Required methods
fn get_latest_release(&self) -> Result<Releases>;
fn get_newer_releases(&self) -> Result<Releases>;
fn get_release_version(&self, ver: &str) -> Result<Release>;
// Provided methods
fn update(&self) -> Result<VersionStatus> { ... }
fn update_extended(&self) -> Result<ReleaseStatus> { ... }
}Expand description
Updates to a specified or latest release.
This trait is sealed (via its UpdateConfig supertrait): it is implemented only by this
crate’s backend Update types and cannot be implemented for types outside the crate. You
consume it through the concrete Update each backend’s build() returns (whose inherent
update() / update_extended() verbs forward here), or as a generic bound — but you do not
implement it yourself.
The shared accessor methods live on the UpdateConfig supertrait. They resolve on a
dyn ReleaseUpdate without importing it, and in generic code bounded R: ReleaseUpdate they
are in scope via the supertrait bound (also no import); bring it into scope
(use self_update::UpdateConfig;) only to call them on a concrete backend Update value.
The trait is sealed transitively: its UpdateConfig supertrait requires
sealed::Sealed (implemented only inside this crate), so ReleaseUpdate cannot be
implemented for a foreign type even though the trait itself has no visible seal.
Required Methods§
Sourcefn get_latest_release(&self) -> Result<Releases>
fn get_latest_release(&self) -> Result<Releases>
Fetch the single newest release from the backend.
The result is a one-element Releases wrapping the raw newest release, unfiltered
(carrying the configured current version). Because the newest release is always present,
.latest() is always Some, and .is_update_available() returns false when that newest
release is not strictly newer than the configured current version. This differs from
get_newer_releases, whose list is filtered to strictly-newer
releases (there, .latest() is None when up to date and any present entry is a genuine
update).
How “newest” treats a non-semver rolling tag (nightly, latest, a date) differs per
backend: gitlab and gitea read the first page of the listing and skip unparseable tags,
returning the first release the updater can compare; github uses the API’s dedicated
/releases/latest endpoint, which returns one designated release — if that release’s
tag is not semver, this errors with Error::SemVer naming
the tag. Prefer get_newer_releases for the skip-enabled path
that behaves identically on every backend.
Sourcefn get_newer_releases(&self) -> Result<Releases>
fn get_newer_releases(&self) -> Result<Releases>
Fetch the candidate releases from the backend as a Releases (newest-first, carrying the
configured current version).
The list is filtered to releases strictly newer than the configured current version, so it
is empty (.latest() is None) when already up to date, and any entry present is a genuine
update.
Releases whose tag is not a semver version after stripping a leading lowercase v (e.g. a
rolling nightly or latest tag) are skipped: the updater cannot compare them. Each skip
is logged at log::debug! level — hook up a logger (e.g. env_logger with
RUST_LOG=self_update=debug) to see which tags were dropped. A listing with no
parseable release behaves as an empty listing
(Error::NoReleaseFound on the update path).
Sourcefn get_release_version(&self, ver: &str) -> Result<Release>
fn get_release_version(&self, ver: &str) -> Result<Release>
Fetch details of the release matching the specified version
Provided Methods§
Sourcefn update(&self) -> Result<VersionStatus>
fn update(&self) -> Result<VersionStatus>
Display release information and update the current binary to the latest release, pending confirmation from the user.
Returns a VersionStatus carrying only the version tag. Use
update_extended instead if you need the full Release details
(name, date, body, assets) of the installed release.
Sourcefn update_extended(&self) -> Result<ReleaseStatus>
fn update_extended(&self) -> Result<ReleaseStatus>
Same as update, but returns ReleaseStatus.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl ReleaseUpdate for self_update::backends::custom::Update
impl ReleaseUpdate for self_update::backends::gitea::Update
gitea only.impl ReleaseUpdate for self_update::backends::gitee::Update
gitee only.impl ReleaseUpdate for self_update::backends::github::Update
github only.impl ReleaseUpdate for self_update::backends::gitlab::Update
gitlab only.impl ReleaseUpdate for self_update::backends::manifest::Update
manifest only.impl ReleaseUpdate for self_update::backends::s3::Update
s3 only.