Skip to main content

Session

Struct Session 

Source
pub struct Session<H: SessionHooks> {
    pub model: Option<H::Model>,
    pub file_path: String,
    pub log: EventLog<H::Event>,
    /* private fields */
}
Expand description

Session routes session-level actions (new, open, save, checkpoint, undo, redo) to the appropriate handler.

Fields§

§model: Option<H::Model>§file_path: String§log: EventLog<H::Event>

Implementations§

Source§

impl<H: SessionHooks> Session<H>

Source

pub fn new(hooks: H) -> Self

Creates a new Session with the given hooks.

Source

pub fn dispatch(&mut self, action: &str) -> String

Parses and executes a session command string. Commands: new “Title” [params…], open PATH, save, save as:PATH, checkpoint NAME, undo, undo to:NAME, redo, status, close

Auto Trait Implementations§

§

impl<H> Freeze for Session<H>
where H: Freeze, <H as SessionHooks>::Model: Freeze,

§

impl<H> RefUnwindSafe for Session<H>

§

impl<H> Send for Session<H>
where H: Send, <H as SessionHooks>::Model: Send, <H as SessionHooks>::Event: Send,

§

impl<H> Sync for Session<H>
where H: Sync, <H as SessionHooks>::Model: Sync, <H as SessionHooks>::Event: Sync,

§

impl<H> Unpin for Session<H>
where H: Unpin, <H as SessionHooks>::Model: Unpin, <H as SessionHooks>::Event: Unpin,

§

impl<H> UnsafeUnpin for Session<H>

§

impl<H> UnwindSafe for Session<H>

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.