Skip to main content

UiSession

Struct UiSession 

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

Window instances and drafts of one UI session.

Implementations§

Source§

impl UiSession

Source

pub fn new(session_id: impl Into<String>, spec: Arc<SessionSpec>) -> Self

Source

pub fn session_id(&self) -> &str

Source

pub fn spec(&self) -> &SessionSpec

Source

pub fn revision(&self) -> u64

Revision of the session state, bumped by every accepted write.

Source

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.

Source

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.

Source

pub fn window_info(&self, kind: usize) -> Option<WindowInfo>

Presentation of an open window instance.

Source

pub fn window_infos(&self) -> Vec<WindowInfo>

Presentation of every open window instance.

Source

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.

Source

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.

Source

pub fn open_windows(&self) -> Vec<WindowInstance>

Source

pub fn find_window(&self, id: &str) -> Option<WindowInstance>

Find the open instance with an external id such as settings#2.

Source

pub fn window_kind(&self, id: &str) -> Option<usize>

Source

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.

Source

pub fn draft_revision(&self, kind: usize) -> Option<u64>

Draft revision of an open window instance.

Source

pub fn pending_close(&self, kind: usize) -> Option<&Confirmation>

The pending close confirmation of a window, which blocks its controls until it is decided.

Source

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.

Source

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.

Source

pub fn get( &self, kind: usize, generation: u64, session: usize, field: usize, ) -> Result<Value, CommandError>

Trait Implementations§

Source§

impl Debug for UiSession

Source§

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

Formats the value using the given formatter. 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.