Skip to main content

Session

Struct Session 

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

One controller’s bounded word state; contains no native objects or callbacks. It holds at most one word of MAX_WORD units plus its Space, the word’s receipt, and 256 UTF-16 units of history.

Implementations§

Source§

impl Session

Source

pub fn has_pending(&self) -> bool

Whether a copied proposal is awaiting acknowledgement.

Source

pub fn has_word(&self) -> bool

Whether the session holds an owned word. This is not evidence that the host still shows the mark, and it grants no native authority.

Source

pub fn reset(&mut self)

Invalidate outstanding tokens and drop all text/receipts on native lifecycle change. The session returns to Idle with no history; the keyboard and fixture selections stay.

Source

pub fn set_fixtures(&mut self, enabled: bool) -> Result<(), Error>

Enable the deterministic fixture policy of Session::propose, which converts only ghbdtn and руддщ, while idle.

§Errors

Error::Invalidated if a word is owned or a proposal awaits acknowledgement.

Source

pub fn set_keyboard(&mut self, keyboard: Keyboard) -> Result<(), Error>

Select the Russian keyboard map for manual conversion and inference while idle. The default is Keyboard::Apple, and Session::reset keeps the selection. A change keeps the word history, which holds finished document text rather than key positions.

§Errors

Error::Invalidated if a word is owned or a proposal awaits acknowledgement.

Source

pub fn propose( &mut self, event: &Event, mode: Mode, context: Context, ) -> Result<Plan, Error>

Construct a proposal using only the opt-in fixture policy. Confirmed state and context remain unchanged until acknowledgement.

§Errors

Error::Invalidated if the session was invalidated or its token counter is exhausted.

Source

pub fn propose_without_automatic( &mut self, event: &Event, mode: Mode, context: Context, ) -> Result<Plan, Error>

Construct a manual-only proposal, ignoring both the model and the fixture policy.

§Errors

Error::Invalidated if the session was invalidated or its token counter is exhausted.

Source

pub fn propose_with_inference( &mut self, event: &Event, mode: Mode, context: Context, model: &Model<'_>, dictionaries: Dictionaries<'_>, policy: Policy, ) -> Result<Plan, Error>

Construct a model-backed proposal with explicit borrowed protection snapshots and policy. Only Space evaluates inference, and not after explicit intent. Context comes from this session’s verified finished words; the pending operation retains no model, vocabulary reference or native callback. See the crate-level example for a complete word.

§Errors

Error::Invalidated if the session was invalidated or its token counter is exhausted.

Source

pub fn acknowledge(&mut self, id: u64, outcome: Outcome) -> Result<(), Error>

Confirm the latest proposal, or drop authority after refusal/unknown effect.

Outcome::Verified advances the session to the proposed state. Any other outcome invalidates the word, its receipt and the language history, and the session refuses proposals until Session::reset.

§Errors

Error::Stale if id is not the pending proposal; state is unchanged.

Trait Implementations§

Source§

impl Default for Session

Source§

fn default() -> Session

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
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.