Struct tauri::updater::UpdateBuilder
source · [−]pub struct UpdateBuilder<R: Runtime> { /* private fields */ }
This is supported on crate feature
updater
only.Expand description
An update check builder.
Implementations
sourceimpl<R: Runtime> UpdateBuilder<R>
impl<R: Runtime> UpdateBuilder<R>
sourcepub fn skip_events(self) -> Self
pub fn skip_events(self) -> Self
Do not use the event system to emit information or listen to install the update.
sourcepub fn target(self, target: impl Into<String>) -> Self
pub fn target(self, target: impl Into<String>) -> Self
Set the target name. Represents the string that is looked up on the updater API or response JSON.
sourcepub fn should_install<F: FnOnce(&str, &str) -> bool + Send + 'static>(
self,
f: F
) -> Self
pub fn should_install<F: FnOnce(&str, &str) -> bool + Send + 'static>(
self,
f: F
) -> Self
Sets a closure that is invoked to compare the current version and the latest version returned by the updater server. The first argument is the current version, and the second one is the latest version.
The closure must return true
if the update should be installed.
Examples
- Always install the version returned by the server:
tauri::Builder::default()
.setup(|app| {
tauri::updater::builder(app.handle()).should_install(|_current, _latest| true);
Ok(())
});
sourcepub async fn check(self) -> Result<UpdateResponse<R>>
pub async fn check(self) -> Result<UpdateResponse<R>>
Check if an update is available.
Examples
tauri::Builder::default()
.setup(|app| {
let handle = app.handle();
tauri::async_runtime::spawn(async move {
match tauri::updater::builder(handle).check().await {
Ok(update) => {}
Err(error) => {}
}
});
Ok(())
});
Trait Implementations
Auto Trait Implementations
impl<R> !RefUnwindSafe for UpdateBuilder<R>
impl<R> Send for UpdateBuilder<R>
impl<R> !Sync for UpdateBuilder<R>
impl<R> Unpin for UpdateBuilder<R> where
<R as Runtime<EventLoopMessage>>::ClipboardManager: Unpin,
<R as Runtime<EventLoopMessage>>::GlobalShortcutManager: Unpin,
<R as Runtime<EventLoopMessage>>::Handle: Unpin,
<R as Runtime<EventLoopMessage>>::TrayHandler: Unpin,
impl<R> !UnwindSafe for UpdateBuilder<R>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more