pub struct Update { /* private fields */ }Expand description
Wraps a ReleaseUpdate and redirects file descriptor 1 while it runs.
Before delegating to the inner update, fd 1 is pointed at the configured
Sink; once the update returns (successfully or not) the original fd 1
is restored. Because the redirect happens at the descriptor level, output
from spawned child processes and native code is diverted too.
§Platform behavior
- Unix: fd 1 is duplicated and swapped via
dup/dup2. - Windows: the process’s standard-output handle is swapped via
GetStdHandle/SetStdHandle(pointed at theNULdevice or the standard-error handle). Rust’sstdre-queriesGetStdHandleon every write, so its output honors the swap for the duration of the update. - Other platforms: redirection is unsupported, so the wrapped update runs unchanged (no redirect is applied).
§Metadata
All metadata methods (including no_confirm, show_output, and
show_download_progress) delegate to the wrapped update. Because a backend
reads its own configuration when it runs, overriding those on the wrapper
would not change the behavior of an arbitrarily deep composition, so this
wrapper relies solely on the fd redirect to keep the update quiet.
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