Skip to main content

Update

Struct Update 

Source
pub struct Update { /* private fields */ }
Expand description

Wraps a ReleaseUpdate and throttles how often update checks run.

The underlying update check is skipped when one was already performed within throttle_window. The time of the last check is tracked via a throttle file in the system temp directory.

§Throttle behavior

The throttle file is touched only after a successful update check. Failed checks do not reset the throttle window, allowing retries without waiting for the full window to elapse.

Implementations§

Source§

impl Update

Source

pub fn configure() -> UpdateBuilder

Initialize a new Update builder.

Source

pub fn throttle_window(&self) -> Duration

The minimum time that must elapse between update checks.

Trait Implementations§

Source§

impl ReleaseUpdate for Update

Source§

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>>

Fetch details of the latest release from the backend
Source§

fn get_release_version(&self, ver: &str) -> Result<Release>

Fetch details of the release matching the specified version
Source§

fn current_version(&self) -> String

Current version of binary being updated
Source§

fn target(&self) -> String

Target platform the update is being performed for
Source§

fn target_version(&self) -> Option<String>

Target version optionally specified for the update
Source§

fn bin_name(&self) -> String

Name of the binary being updated
Source§

fn bin_install_path(&self) -> PathBuf

Installation path for the binary being updated
Source§

fn bin_path_in_archive(&self) -> String

Path of the binary to be extracted from release package
Source§

fn show_download_progress(&self) -> bool

Flag indicating if progress information shall be output when downloading a release
Source§

fn show_output(&self) -> bool

Flag indicating if process informative messages shall be output
Source§

fn no_confirm(&self) -> bool

Flag indicating if the user shouldn’t be prompted to confirm an update
Source§

fn progress_template(&self) -> String

Source§

fn progress_chars(&self) -> String

Source§

fn auth_token(&self) -> Option<String>

Authorisation token for communicating with backend
Source§

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>

Same as update, but returns UpdateStatus.
Source§

fn identifier(&self) -> Option<String>

Optional identifier of determining the asset among multiple matches
Source§

fn api_headers(&self, auth_token: &Option<String>) -> Result<HeaderMap, Error>

Construct a header with an authorisation entry if an auth token is provided

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more