pub struct SessionState {
pub id: SessionId,
pub history: HistoryStack,
pub bookmarks: BookmarkStore,
pub origins: BTreeMap<Origin, OriginState>,
pub ui: SessionUiState,
}Expand description
Complete persisted browsing session state.
Fields§
§id: SessionIdSession identifier.
history: HistoryStackBack/forward navigation state.
bookmarks: BookmarkStoreSaved bookmarks.
origins: BTreeMap<Origin, OriginState>Per-origin state.
ui: SessionUiStatePersisted terminal UI preferences.
Implementations§
Source§impl SessionState
impl SessionState
Sourcepub fn visit_entry(&mut self, entry: HistoryEntry)
pub fn visit_entry(&mut self, entry: HistoryEntry)
Visits a history entry in this session.
Sourcepub fn go_back(&mut self) -> Option<&HistoryEntry>
pub fn go_back(&mut self) -> Option<&HistoryEntry>
Moves one step back.
Sourcepub fn go_forward(&mut self) -> Option<&HistoryEntry>
pub fn go_forward(&mut self) -> Option<&HistoryEntry>
Moves one step forward.
Sourcepub fn bookmark_current(&mut self, title: impl Into<String>) -> Option<()>
pub fn bookmark_current(&mut self, title: impl Into<String>) -> Option<()>
Bookmarks the current page when one is loaded.
Sourcepub fn serialize(&self) -> String
pub fn serialize(&self) -> String
Serializes the session to a deterministic text representation.
Sourcepub fn deserialize(contents: &str) -> Result<Self, SessionError>
pub fn deserialize(contents: &str) -> Result<Self, SessionError>
Deserializes a saved session.
Sourcepub fn save_to_path(&self, path: impl AsRef<Path>) -> Result<(), SessionError>
pub fn save_to_path(&self, path: impl AsRef<Path>) -> Result<(), SessionError>
Saves the session to disk.
Sourcepub fn load_from_path(path: impl AsRef<Path>) -> Result<Self, SessionError>
pub fn load_from_path(path: impl AsRef<Path>) -> Result<Self, SessionError>
Loads a session from disk.
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 (const: unstable) · 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 PartialEq for SessionState
impl PartialEq for SessionState
Source§fn eq(&self, other: &SessionState) -> bool
fn eq(&self, other: &SessionState) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq 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 UnsafeUnpin 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