HostState

Struct HostState 

Source
pub struct HostState {
    pub pending_window_creations: VecDeque<PendingWindowCreation>,
    pub browser_panes: HashMap<String, BrowserPaneEntry>,
    pub browsers: HashMap<String, BrowserHandle>,
    pub active_drag: Option<DragSession>,
    pub pool: PoolState,
    pub quit_state: QuitState,
    pub top_level_creation: TopLevelCreationState,
    pub window_opacities: HashMap<String, f32>,
    pub lifecycle: HostLifecyclePhase,
    pub event_version: u64,
}
Expand description

State owned by the host reducer.

Held inside AppState.host_state: parking_lot::Mutex<HostState>. Locked briefly by host_dispatch; never held across CEF callbacks or SendMessage (snapshot-and-drop discipline — see spec §6).

Fields§

§pending_window_creations: VecDeque<PendingWindowCreation>

FIFO queue of pre-create handoffs. Pushed by callers (pane/creation.rs, commands/window.rs::open_new_window, commands/drag.rs::tear_off, commands/window_pool.rs::spawn_pool_window) before post_create_window. Popped by client.rs::on_after_created when CEF reports a new browser. Peeked at the back by wrr/win_event.rs::handle_event to label OS-level WM_CREATE events with the upcoming label.

Invariants:

  • At most one entry per (in-flight) browser create.
  • on_after_created always pops the head it expects to find.
  • The “main” window is special-cased in on_after_created and never has a corresponding entry here.
§browser_panes: HashMap<String, BrowserPaneEntry>

H.1 — pane lifecycle map. Replaces the deleted pane::lifecycle::PaneStateMachine. Keyed by block_id. Authoritative; BrowserPaneManager (browser_panes.rs) is now a zero-sized handle that delegates all mutations through host_dispatch.

§browsers: HashMap<String, BrowserHandle>

H.2 — browser handle registry. Replaces the deleted AppState.browsers: Mutex<HashMap<String, Browser>>. Keyed by label (e.g., window-..., browser-pane-..., window-pool-...). Authoritative; read via AppState::get_browser, list_browsers, etc.

§active_drag: Option<DragSession>

H.3 — active drag session (singleton). Replaces the deleted AppState.active_drag: Mutex<Option<DragSession>>.

§pool: PoolState

H.4 — pool state (queue + unpromoted + in-flight semaphore + just_promoted_labels bridge from PR #708). Replaces the deleted window_pool / unpromoted_pool_labels fields on AppState.

§quit_state: QuitState

H.5 — quit lifecycle. Replaces the deleted AppState.is_quitting: AtomicBool.

§top_level_creation: TopLevelCreationState

H.6 — top-level window creation runner state (queue, in-flight, history). Event-driven; no watchdog. Currently DORMANT — the reducer arms (EnqueueTopLevelWindow, TopLevelCallbackFired, etc.) exist but no production code dispatches to them. The ui_tasks::post_create_window direct-call path is still authoritative. Wire-up is a low-priority structural improvement; see master spec §4.3 and discussion #707.

§window_opacities: HashMap<String, f32>

Per-window opacity state. Keyed by label, value is clamped [0.0, 1.0]. Absent means fully opaque (1.0). Mutated by SetWindowOpacity; read by get_window_opacity and the restore path in app-init. Win32 side-effect (SetLayeredWindowAttributes) is applied by the IPC handler AFTER dispatch, not inside the reducer. See SPEC_PER_WINDOW_OPACITY_2026-05-14.md §7.1.

§lifecycle: HostLifecyclePhase

Lifecycle phase. Running is the operating state; the others gate command acceptance.

§event_version: u64

Monotonic event-version counter (per host-process run). Same invariant as launcher / srv reducers.

Implementations§

Source§

impl HostState

Source

fn bump_version(&mut self) -> u64

Allocate the next event version. Called inside reducer arms when emitting an event.

Trait Implementations§

Source§

impl Default for HostState

Source§

fn default() -> Self

Returns the “default value” for a type. 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
§

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

§

fn into_raw(self) -> U

§

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

§

fn wrap_result(self) -> U

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

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.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: 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, 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,