Skip to main content

RestartSession

Struct RestartSession 

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

A primary-installer Restart Manager session.

Shutdown consumes this value and produces a RestartPending, so restart cannot be called out of sequence. This typestate is Send.

Implementations§

Source§

impl RestartSession

Source

pub fn new() -> Result<Self>

Starts a new primary-installer session.

Source

pub fn session_key(&self) -> &SessionKey

Returns the key a secondary installer can pass to JoinedSession::join.

Source

pub fn register_resources(&mut self, resources: &ResourceBatch) -> Result<()>

Registers a mixed collection in one native call.

Source

pub fn register_files<I, P>(&mut self, files: I) -> Result<()>
where I: IntoIterator<Item = P>, P: AsRef<Path>,

Registers file paths. Directories are rejected by Restart Manager.

Source

pub fn register_processes<I, P>(&mut self, processes: I) -> Result<()>
where I: IntoIterator<Item = P>, P: Borrow<ProcessIdentity>,

Registers exact process identities from any iterator.

Source

pub fn register_services<I, S>(&mut self, services: I) -> Result<()>
where I: IntoIterator<Item = S>, S: AsRef<OsStr>,

Registers Windows services by short name.

Source

pub fn affected_applications(&mut self) -> Result<AffectedApplications>

Takes a reusable snapshot of affected applications and reboot reasons.

Source

pub fn cancellation_handle(&self) -> CancellationHandle

Creates a weak, thread-safe cancellation capability.

Source

pub fn shutdown(self) -> RestartPending

Gracefully attempts shutdown and always enters the recovery-required state.

Source

pub fn shutdown_with_options(self, options: ShutdownOptions) -> RestartPending

Attempts shutdown and retains its outcome regardless of native success.

Source

pub fn shutdown_with_progress<F>( self, options: ShutdownOptions, callback: F, ) -> Result<RestartPending, OperationNotStarted<Self>>
where F: FnMut(Progress) + Send,

Attempts shutdown while delivering validated, strictly increasing progress.

If the process-global callback lease cannot be acquired, the returned error also returns this session and no native operation has started.

Source

pub fn set_filter( &mut self, target: &FilterTarget, action: FilterAction, ) -> Result<()>

Adds or replaces a restart/shutdown filter.

Source

pub fn remove_filter(&mut self, target: &FilterTarget) -> Result<()>

Removes a filter from the selected target.

Source

pub fn filters(&mut self) -> Result<Vec<Filter>>

Lists filters configured by this primary installer.

Source

pub fn end(self) -> Result<()>

Ends the session without attempting shutdown.

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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