pub struct SessionState { /* private fields */ }Expand description
Session state that persists across commands.
Implementations§
Source§impl SessionState
impl SessionState
Sourcepub fn loaded_models(&self) -> &HashMap<String, LoadedModel>
pub fn loaded_models(&self) -> &HashMap<String, LoadedModel>
Get loaded models.
Sourcepub fn history(&self) -> &[HistoryEntry]
pub fn history(&self) -> &[HistoryEntry]
Get command history.
Sourcepub fn add_model(&mut self, name: String, model: LoadedModel)
pub fn add_model(&mut self, name: String, model: LoadedModel)
Add a model to the session.
Sourcepub fn remove_model(&mut self, name: &str) -> Option<LoadedModel>
pub fn remove_model(&mut self, name: &str) -> Option<LoadedModel>
Remove a model from the session.
Sourcepub fn get_model(&self, name: &str) -> Option<&LoadedModel>
pub fn get_model(&self, name: &str) -> Option<&LoadedModel>
Get a model by name.
Sourcepub fn add_to_history(&mut self, entry: HistoryEntry)
pub fn add_to_history(&mut self, entry: HistoryEntry)
Add a command to history.
Sourcepub fn preferences_mut(&mut self) -> &mut Preferences
pub fn preferences_mut(&mut self) -> &mut Preferences
Get mutable preferences.
Sourcepub fn preferences(&self) -> &Preferences
pub fn preferences(&self) -> &Preferences
Get preferences.
Sourcepub fn metrics(&self) -> &SessionMetrics
pub fn metrics(&self) -> &SessionMetrics
Get session metrics.
Sourcepub fn record_command(&mut self, duration_ms: u64, success: bool)
pub fn record_command(&mut self, duration_ms: u64, success: bool)
Update metrics after a command.
Trait Implementations§
Source§impl Clone for SessionState
impl Clone for SessionState
Source§fn clone(&self) -> SessionState
fn clone(&self) -> SessionState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionState
impl Debug for SessionState
Source§impl Default for SessionState
impl Default for SessionState
Source§fn default() -> SessionState
fn default() -> SessionState
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for SessionState
impl<'de> Deserialize<'de> for SessionState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for SessionState
impl PartialEq for SessionState
Source§impl Serialize for SessionState
impl Serialize for SessionState
impl StructuralPartialEq for SessionState
Auto Trait Implementations§
impl Freeze for SessionState
impl RefUnwindSafe for SessionState
impl Send for SessionState
impl Sync for SessionState
impl Unpin for SessionState
impl UnwindSafe for SessionState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more