Skip to main content

Session

Struct Session 

Source
pub struct Session<T: Transport> { /* private fields */ }
Expand description

A session over a transport, with per-pane subscriptions and an experience mode. The mode is session state (a value); switching it never changes the values being shown.

Implementations§

Source§

impl<T: Transport> Session<T>

Source

pub fn new(transport: T) -> Self

Start a session over transport in Builder mode.

Source

pub fn status(&self) -> SessionStatus

The visible connection status.

Source

pub fn mode(&self) -> Mode

The active experience mode.

Source

pub fn set_mode(&mut self, intent: &Expr) -> Result<()>

Handle an intent/set-mode, switching the session mode. The values being shown are never read or written.

Source

pub fn render_universal(&self, value: &Expr) -> Expr

Render a value through the universal default lens at the session’s mode depth (Household/Builder/Systems show progressively more).

Source

pub fn transport_mut(&mut self) -> &mut T

Mutable access to the transport (for example to simulate disconnect in tests, or to drive reconnection).

Source

pub fn open( &mut self, cx: &mut Cx, registry: &LensRegistry, pane: Symbol, resource: Symbol, view_lens: Symbol, editor_lens: Symbol, ) -> Result<Expr>

Open resource into pane with the given view and editor lenses; render and subscribe. Returns the initial Scene.

Source

pub fn submit_intent( &mut self, cx: &mut Cx, registry: &LensRegistry, pane: &Symbol, intent: &Expr, ) -> Result<()>

Submit an Intent against the value shown in pane: decode through the pane’s editor and commit the operation through realize.

Source

pub fn pump( &mut self, cx: &mut Cx, registry: &LensRegistry, ) -> Result<Vec<SceneUpdate>>

Drain pending changes and re-render only the affected panes, returning a Scene update (with diff) for each.

Auto Trait Implementations§

§

impl<T> Freeze for Session<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Session<T>
where T: RefUnwindSafe,

§

impl<T> Send for Session<T>
where T: Send,

§

impl<T> Sync for Session<T>
where T: Sync,

§

impl<T> Unpin for Session<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Session<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Session<T>
where T: UnwindSafe,

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.