pub struct WorktreesService { /* private fields */ }Expand description
Hosts the cross-window WorktreesRegistry as a DaemonService.
Implementations§
Source§impl WorktreesService
impl WorktreesService
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates the service with an empty registry. Cheap — no I/O and no task;
the daemon calls start_menu_refresh to begin
off-thread menu caching, while tests use the bare service (menu computed
inline on demand).
Starts the background task that recomputes the tray menu snapshot every
[MENU_REFRESH_INTERVAL] off the main thread — git enrichment is
blocking disk I/O — and stores it in menu_cache, so
the macOS tray’s menu() serves a cache instead of running git on the GUI
event loop. Idempotent, and a no-op outside a tokio runtime (mirroring the
Snowflake keep-alive heartbeat), so unit tests that build a bare service
keep computing the menu inline.
Trait Implementations§
Source§impl DaemonService for WorktreesService
impl DaemonService for WorktreesService
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
Stable identifier used to route control-socket envelopes to this service
(the envelope’s
service field) and to label its status/menu.Source§fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
op: &'life1 str,
payload: Value,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
op: &'life1 str,
payload: Value,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles an operation routed to this service, returning a JSON payload.
Cheap snapshot of the service’s tray submenu, polled by the menu-bar
shell. Must not block.
Performs a tray menu action previously surfaced by
menu,
identified by its MenuAction::id.Auto Trait Implementations§
impl !Freeze for WorktreesService
impl RefUnwindSafe for WorktreesService
impl Send for WorktreesService
impl Sync for WorktreesService
impl Unpin for WorktreesService
impl UnsafeUnpin for WorktreesService
impl UnwindSafe for WorktreesService
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