Skip to main content

WindowsSettingsDefaultTerminalApplicationGuard

Struct WindowsSettingsDefaultTerminalApplicationGuard 

pub struct WindowsSettingsDefaultTerminalApplicationGuard<R: Registry> {
    pub(crate) changed: bool,
    pub(crate) key_existed: bool,
    pub(crate) old_windows_terminal_console: Option<String>,
    pub(crate) old_windows_terminal_terminal: Option<String>,
    pub(crate) registry: R,
}
Expand description

Guard that configures conhost.exe as the default terminal application and fully reverts its changes when dropped.

Restoration is exact: values the guard overwrote are set back, values it created are deleted, and a startup key the guard had to create is removed.

Fields§

§changed: bool

Whether the guard changed the registry and must undo it on drop.

§key_existed: bool

Whether the startup key existed before the guard; if not, drop deletes it.

§old_windows_terminal_console: Option<String>

DelegationConsole before the guard overwrote it, or None if it was absent.

§old_windows_terminal_terminal: Option<String>

DelegationTerminal before the guard overwrote it, or None if it was absent.

§registry: R

Registry operations trait

Implementations§

§

impl<R: Registry> WindowsSettingsDefaultTerminalApplicationGuard<R>

pub fn new_with_registry(registry: R) -> Self

Create a new guard, forcing conhost.exe as the default terminal application.

§Arguments
  • registry - Registry operations implementation
§Returns

A new guard that reverts its registry changes on drop.

pub(crate) fn restore_value(&self, name: &str, previous: &Option<String>)

Restore name to its pre-guard value, or delete it if it was absent.

§

impl WindowsSettingsDefaultTerminalApplicationGuard<DefaultRegistry>

pub fn new() -> Self

Create a new guard with production registry operations

Trait Implementations§

§

impl<R> Default for WindowsSettingsDefaultTerminalApplicationGuard<R>
where R: Default + Registry,

§

fn default() -> Self

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

impl<R: Registry> Drop for WindowsSettingsDefaultTerminalApplicationGuard<R>

§

fn drop(&mut self)

Revert every registry change the guard made.

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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> 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.