Skip to main content

UpdateClient

Struct UpdateClient 

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

Checks Tauri-compatible updater JSON and stages only successfully verified artifacts.

Implementations§

Source§

impl UpdateClient

Source

pub fn new(current_version: &str, public_key: impl Into<String>) -> Result<Self>

Source

pub fn target(self, target: impl Into<String>) -> Result<Self>

Source

pub fn maximum_download_bytes(self, maximum: u64) -> Result<Self>

Source

pub fn check(&self, endpoint: &str) -> Result<Option<AvailableUpdate>>

Fetch bounded update metadata and return None when the remote version is not newer.

Source

pub fn check_with_cancellation( &self, endpoint: &str, cancellation: &UpdateCancellation, ) -> Result<Option<AvailableUpdate>>

Fetch update metadata while cooperatively observing cancellation between I/O reads.

Source

pub fn parse_manifest(&self, bytes: &[u8]) -> Result<Option<AvailableUpdate>>

Parse already-fetched metadata using the same bounded, target-aware rules as Self::check.

Source

pub fn download_and_stage( &self, update: &AvailableUpdate, destination_directory: impl AsRef<Path>, ) -> Result<PathBuf>

Download, stream-verify, fsync, and atomically persist an update artifact.

Source

pub fn download_and_stage_with_progress( &self, update: &AvailableUpdate, destination_directory: impl AsRef<Path>, on_progress: impl FnMut(UpdateProgress), ) -> Result<PathBuf>

Download and stage while reporting bounded byte progress on the calling thread.

Source

pub fn download_and_stage_with_progress_and_cancellation( &self, update: &AvailableUpdate, destination_directory: impl AsRef<Path>, on_progress: impl FnMut(UpdateProgress), cancellation: &UpdateCancellation, ) -> Result<PathBuf>

Download and stage with progress plus cooperative cancellation between bounded chunks.

Source

pub fn verify_file(&self, path: impl AsRef<Path>, signature: &str) -> Result<()>

Verify an existing local artifact using the configured public key and bounded streaming.

Source

pub fn verify_file_with_cancellation( &self, path: impl AsRef<Path>, signature: &str, cancellation: &UpdateCancellation, ) -> Result<()>

Source

pub fn install_staged( &self, update: &AvailableUpdate, artifact: impl AsRef<Path>, options: UpdateInstallOptions, ) -> Result<InstalledUpdate>

Re-verify and install a staged artifact using the current platform’s native strategy.

macOS expects a gzip-compressed tar archive containing one .app bundle. Linux accepts a raw executable or a gzip-compressed tar archive containing one AppImage. Windows launches an .exe or .msi installer with the configured UI policy. The caller should request an orderly application relaunch after an applied Unix update, or orderly exit after a Windows installer is launched.

Source

pub fn install_staged_with_progress( &self, update: &AvailableUpdate, artifact: impl AsRef<Path>, options: UpdateInstallOptions, on_progress: impl FnMut(UpdateProgress), ) -> Result<InstalledUpdate>

Source

pub fn install_staged_with_progress_and_cancellation( &self, update: &AvailableUpdate, artifact: impl AsRef<Path>, options: UpdateInstallOptions, on_progress: impl FnMut(UpdateProgress), cancellation: &UpdateCancellation, ) -> Result<InstalledUpdate>

Re-verify and install while observing cancellation before every reversible phase.

Trait Implementations§

Source§

impl Clone for UpdateClient

Source§

fn clone(&self) -> UpdateClient

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UpdateClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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