pub struct CompanionService { /* private fields */ }Expand description
Main companion service that coordinates all subsystems
Implementations§
Source§impl CompanionService
impl CompanionService
Sourcepub fn new(repo_path: PathBuf, branch: &str) -> Result<Self>
pub fn new(repo_path: PathBuf, branch: &str) -> Result<Self>
Create a new companion service for the given repository
Sourcepub fn session(&self) -> &Arc<RwLock<SessionState>>
pub fn session(&self) -> &Arc<RwLock<SessionState>>
Get the current session state
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 for the given branch
Sourcepub fn save_branch_memory(&self, memory: &BranchMemory) -> Result<()>
pub fn save_branch_memory(&self, memory: &BranchMemory) -> Result<()>
Save branch memory
Sourcepub fn save_session(&self) -> Result<()>
pub fn save_session(&self) -> Result<()>
Save current session state
Sourcepub fn touch_file(&self, path: PathBuf)
pub fn touch_file(&self, path: PathBuf)
Record a file touch (opened/modified)
Sourcepub fn record_commit(&self, hash: String)
pub fn record_commit(&self, hash: String)
Record a commit was made
Sourcepub fn try_recv_event(&mut self) -> Option<CompanionEvent>
pub fn try_recv_event(&mut self) -> Option<CompanionEvent>
Try to receive the next companion event (non-blocking)
Sourcepub fn has_watcher(&self) -> bool
pub fn has_watcher(&self) -> bool
Check if file watcher is active
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CompanionService
impl !RefUnwindSafe for CompanionService
impl Send for CompanionService
impl Sync for CompanionService
impl Unpin for CompanionService
impl !UnwindSafe for CompanionService
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