Skip to main content

SessionManager

Struct SessionManager 

Source
pub struct SessionManager {
    pub engine: RealityEngine,
    pub data_path: Option<String>,
    pub workspace_id: Option<String>,
    pub autosave: bool,
}
Expand description

Manages the reality engine session.

Fields§

§engine: RealityEngine

The reality engine instance.

§data_path: Option<String>

Path to the .areal data file (if persistence is enabled).

§workspace_id: Option<String>

Workspace identifier derived from the canonical data path.

§autosave: bool

Whether autosave is enabled.

Implementations§

Source§

impl SessionManager

Source

pub fn new() -> Self

Create a new session with no persistence.

Source

pub fn with_path(path: String) -> Self

Create a new session with a data path for persistence.

Source

pub fn set_autosave(&mut self, enabled: bool)

Enable or disable autosave.

Source

pub fn is_dirty(&self) -> bool

Whether the engine has unsaved changes.

Source

pub fn save(&mut self) -> Result<bool, SessionError>

Save the session to disk if a data path is configured.

Returns Ok(true) if data was written, Ok(false) if no path is set.

Source

pub fn load(&mut self) -> Result<bool, SessionError>

Load session data from disk if a data path is configured.

Returns Ok(true) if data was loaded, Ok(false) if no path or file missing.

Source

pub fn autosave_if_dirty(&mut self) -> Result<bool, SessionError>

Save if dirty and autosave is enabled.

Source

pub fn workspace_id(&self) -> Option<&str>

Get the workspace identifier.

Trait Implementations§

Source§

impl Default for SessionManager

Source§

fn default() -> Self

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.