pub struct UiSession { /* private fields */ }Expand description
Window instances and drafts of one UI session.
Implementations§
Source§impl UiSession
impl UiSession
pub fn new(session_id: impl Into<String>, spec: Arc<SessionSpec>) -> Self
pub fn session_id(&self) -> &str
pub fn spec(&self) -> &SessionSpec
Sourcepub fn window_opened(
&mut self,
kind: usize,
) -> Result<WindowInstance, CommandError>
pub fn window_opened( &mut self, kind: usize, ) -> Result<WindowInstance, CommandError>
The adapter observed that a window of kind is shown. Reporting an
already open window returns the same instance; a reopened window
starts a new generation with fresh drafts.
Sourcepub fn window_facts(
&mut self,
kind: usize,
generation: u64,
facts: WindowFacts,
source: FactSource,
) -> Result<u64, CommandError>
pub fn window_facts( &mut self, kind: usize, generation: u64, facts: WindowFacts, source: FactSource, ) -> Result<u64, CommandError>
The target reports what the platform shows for a window instance. Facts for a closed or replaced instance are rejected as stale; unchanged facts keep the version. Returns the fact version.
Sourcepub fn window_info(&self, kind: usize) -> Option<WindowInfo>
pub fn window_info(&self, kind: usize) -> Option<WindowInfo>
Presentation of an open window instance.
Sourcepub fn window_infos(&self) -> Vec<WindowInfo>
pub fn window_infos(&self) -> Vec<WindowInfo>
Presentation of every open window instance.
Sourcepub fn check_action(
&self,
window: &str,
action: WindowAction,
) -> Result<WindowInstance, CommandError>
pub fn check_action( &self, window: &str, action: WindowAction, ) -> Result<WindowInstance, CommandError>
Check that action is available on the open instance window
according to the latest facts, before the target performs it.
Sourcepub fn window_closed(&mut self, kind: usize, generation: u64) -> bool
pub fn window_closed(&mut self, kind: usize, generation: u64) -> bool
The adapter observed that a window instance closed. Window-scoped drafts are released; a stale generation is ignored.
pub fn open_windows(&self) -> Vec<WindowInstance>
Sourcepub fn find_window(&self, id: &str) -> Option<WindowInstance>
pub fn find_window(&self, id: &str) -> Option<WindowInstance>
Find the open instance with an external id such as settings#2.
pub fn window_kind(&self, id: &str) -> Option<usize>
Sourcepub fn set(
&mut self,
kind: usize,
generation: u64,
session: usize,
field: usize,
value: Value,
) -> Result<u64, CommandError>
pub fn set( &mut self, kind: usize, generation: u64, session: usize, field: usize, value: Value, ) -> Result<u64, CommandError>
Write one session field after checking it against the schema.
Sourcepub fn draft_revision(&self, kind: usize) -> Option<u64>
pub fn draft_revision(&self, kind: usize) -> Option<u64>
Draft revision of an open window instance.
Sourcepub fn pending_close(&self, kind: usize) -> Option<&Confirmation>
pub fn pending_close(&self, kind: usize) -> Option<&Confirmation>
The pending close confirmation of a window, which blocks its controls until it is decided.
Sourcepub fn request_close(
&mut self,
kind: usize,
generation: u64,
needs_confirmation: bool,
can_save: bool,
) -> Result<CloseStep, CommandError>
pub fn request_close( &mut self, kind: usize, generation: u64, needs_confirmation: bool, can_save: bool, ) -> Result<CloseStep, CommandError>
Request closing a window instance. The target evaluated the
window’s declared close check into needs_confirmation; can_save
tells whether the window declares a save command.
Sourcepub fn confirm_close(
&mut self,
kind: usize,
generation: u64,
confirmation: &str,
decision: CloseDecision,
) -> Result<DecisionStep, CommandError>
pub fn confirm_close( &mut self, kind: usize, generation: u64, confirmation: &str, decision: CloseDecision, ) -> Result<DecisionStep, CommandError>
Decide a pending confirmation. A decision for another confirmation, a closed or reopened window, or drafts edited after the confirmation is rejected as stale.