pub struct CompanionStorage { /* private fields */ }Expand description
Storage backend for companion data
Implementations§
Source§impl CompanionStorage
impl CompanionStorage
Sourcepub fn new(repo_path: &Path) -> Result<Self>
pub fn new(repo_path: &Path) -> Result<Self>
Create a new storage instance for the given repository
§Errors
Returns an error when the companion storage directories cannot be created.
Sourcepub fn save_session(&self, session: &SessionState) -> Result<()>
pub fn save_session(&self, session: &SessionState) -> Result<()>
Sourcepub fn load_session(&self) -> Result<Option<SessionState>>
pub fn load_session(&self) -> Result<Option<SessionState>>
Load session state
§Errors
Returns an error when the session file exists but cannot be read or parsed.
Sourcepub fn save_branch_memory(&self, memory: &BranchMemory) -> Result<()>
pub fn save_branch_memory(&self, memory: &BranchMemory) -> Result<()>
Sourcepub fn load_branch_memory(&self, branch: &str) -> Result<Option<BranchMemory>>
pub fn load_branch_memory(&self, branch: &str) -> Result<Option<BranchMemory>>
Load branch memory
§Errors
Returns an error when the branch memory file exists but cannot be read or parsed.
Sourcepub fn list_branches(&self) -> Result<Vec<String>>
pub fn list_branches(&self) -> Result<Vec<String>>
List all branch memories for this repo
§Errors
Returns an error when the branch memory directory cannot be read.
Sourcepub fn clear_session(&self) -> Result<()>
pub fn clear_session(&self) -> Result<()>
Auto Trait Implementations§
impl Freeze for CompanionStorage
impl RefUnwindSafe for CompanionStorage
impl Send for CompanionStorage
impl Sync for CompanionStorage
impl Unpin for CompanionStorage
impl UnsafeUnpin for CompanionStorage
impl UnwindSafe for CompanionStorage
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more