Skip to main content

DefaultLauncher

Struct DefaultLauncher 

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

The default Launcher: relaunches with the library’s RESUME_FLAG and spawns a detached child process. Used unless UpdateManager::with_launcher installs a different one.

It can carry extra command-line arguments and environment variables through to the relaunched process, so the common cases need no custom Launcher:

use update_rs::DefaultLauncher;

let launcher = DefaultLauncher::new()
    .with_arg("--updated")
    .with_env("APP_UPDATING", "1");

Implementations§

Source§

impl DefaultLauncher

Source

pub fn new() -> Self

Create a default launcher with no extra arguments or environment variables.

Source

pub fn with_arg(self, arg: impl Into<OsString>) -> Self

Append a custom argument to every relaunch, after the resume arguments. Call repeatedly to add several.

Source

pub fn with_args<I, A>(self, args: I) -> Self
where I: IntoIterator<Item = A>, A: Into<OsString>,

Append several custom arguments to every relaunch.

Source

pub fn with_env( self, key: impl Into<OsString>, value: impl Into<OsString>, ) -> Self

Set a custom environment variable on every relaunched process. Call repeatedly to set several.

Source

pub fn with_envs<I, K, V>(self, envs: I) -> Self
where I: IntoIterator<Item = (K, V)>, K: Into<OsString>, V: Into<OsString>,

Set several custom environment variables on every relaunched process.

Trait Implementations§

Source§

impl Clone for DefaultLauncher

Source§

fn clone(&self) -> DefaultLauncher

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 DefaultLauncher

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for DefaultLauncher

Source§

fn default() -> DefaultLauncher

Returns the “default value” for a type. Read more
Source§

impl Launcher for DefaultLauncher

Source§

fn extra_args(&self) -> Vec<OsString>

Extra command-line arguments to append to the relaunch command, after the resume_args. Read more
Source§

fn extra_envs(&self) -> Vec<(OsString, OsString)>

Extra environment variables to set on the relaunched process (added to, not replacing, the inherited environment). Read more
Source§

fn resume_args(&self, state_json: &str) -> Vec<OsString>

The arguments that carry the serialized resume state_json to the relaunched process. Read more
Source§

fn launch(&self, app_path: &Path, state: &UpdateState) -> Result<(), Error>

Build and spawn the command that relaunches app_path to continue the update with state. Read more
Source§

fn detach(&self, cmd: &mut Command)

Apply the platform-specific flags that detach the relaunched process from the current console so it survives the parent exiting (a detached process in its own group on Windows). A no-op on non-Windows platforms. Exposed so custom launch implementations can reuse it.
Source§

fn spawn(&self, cmd: Command) -> Result<(), Error>

Spawn the prepared Command. The default starts the child process and returns immediately. This is the single seam the default launch relies on, so tests can mock it.

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> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
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> 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 = 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