pub struct Update { /* private fields */ }Expand description
Wraps a ReleaseUpdate and restarts the process with the freshly
installed binary after a successful update.
After update() returns Status::Updated, the process is re-executed
using the new binary. A guard environment variable prevents restart loops:
once the restarted process detects the guard, it returns UpToDate instead
of restarting again.
§Platform behavior
- Unix: Replaces the current process image via
exec(never returns on success). - Windows: Spawns the new binary and exits with the child’s status code.
§Guard environment variable
Defaults to RESTART_GUARD but can be customized via
UpdateBuilder::guard_env. The value is set to
"1" during re-execution.
Implementations§
Trait Implementations§
Source§impl ReleaseUpdate for Update
impl ReleaseUpdate for Update
Source§fn get_latest_release(&self) -> Result<Release>
fn get_latest_release(&self) -> Result<Release>
Fetch details of the latest release from the backend
Source§fn get_latest_releases(&self, current_version: &str) -> Result<Vec<Release>>
fn get_latest_releases(&self, current_version: &str) -> Result<Vec<Release>>
Fetch details of the latest release from the backend
Source§fn 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
Source§fn current_version(&self) -> String
fn current_version(&self) -> String
Current version of binary being updated
Source§fn target_version(&self) -> Option<String>
fn target_version(&self) -> Option<String>
Target version optionally specified for the update
Source§fn bin_install_path(&self) -> PathBuf
fn bin_install_path(&self) -> PathBuf
Installation path for the binary being updated
Source§fn bin_path_in_archive(&self) -> String
fn bin_path_in_archive(&self) -> String
Path of the binary to be extracted from release package
Source§fn show_download_progress(&self) -> bool
fn show_download_progress(&self) -> bool
Flag indicating if progress information shall be output when downloading a release
Source§fn show_output(&self) -> bool
fn show_output(&self) -> bool
Flag indicating if process informative messages shall be output
Source§fn no_confirm(&self) -> bool
fn no_confirm(&self) -> bool
Flag indicating if the user shouldn’t be prompted to confirm an update
fn progress_template(&self) -> String
fn progress_chars(&self) -> String
Source§fn auth_token(&self) -> Option<String>
fn auth_token(&self) -> Option<String>
Authorisation token for communicating with backend
Source§fn update(&self) -> Result<Status>
fn update(&self) -> Result<Status>
Display release information and update the current binary to the latest release, pending
confirmation from the user
Source§fn update_extended(&self) -> Result<UpdateStatus>
fn update_extended(&self) -> Result<UpdateStatus>
Same as
update, but returns UpdateStatus.Source§fn identifier(&self) -> Option<String>
fn identifier(&self) -> Option<String>
Optional identifier of determining the asset among multiple matches
Auto Trait Implementations§
impl !RefUnwindSafe for Update
impl !Send for Update
impl !Sync for Update
impl !UnwindSafe for Update
impl Freeze for Update
impl Unpin for Update
impl UnsafeUnpin for Update
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more