diff options
Diffstat (limited to 'crates/turtle/src/atuin_client/settings/watcher.rs')
| -rw-r--r-- | crates/turtle/src/atuin_client/settings/watcher.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/turtle/src/atuin_client/settings/watcher.rs b/crates/turtle/src/atuin_client/settings/watcher.rs index 7548573e..20082639 100644 --- a/crates/turtle/src/atuin_client/settings/watcher.rs +++ b/crates/turtle/src/atuin_client/settings/watcher.rs @@ -44,7 +44,7 @@ static SETTINGS_WATCHER: OnceLock<Result<SettingsWatcher, String>> = OnceLock::n /// /// Initializes the watcher on first call. Subsequent calls return the same instance. /// The watcher monitors the config file for changes and broadcasts updates. -pub fn global_settings_watcher() -> Result<&'static SettingsWatcher> { +pub(crate) fn global_settings_watcher() -> Result<&'static SettingsWatcher> { let result = SETTINGS_WATCHER.get_or_init(|| SettingsWatcher::new().map_err(|e| e.to_string())); match result { @@ -57,7 +57,7 @@ pub fn global_settings_watcher() -> Result<&'static SettingsWatcher> { /// /// Uses `notify` for cross-platform file watching and `tokio::sync::watch` /// for efficient broadcast to multiple subscribers. -pub struct SettingsWatcher { +pub(crate) struct SettingsWatcher { /// Receiver for settings updates. Clone this to subscribe. rx: watch::Receiver<Arc<Settings>>, /// Keeps the file watcher alive for the lifetime of this struct. @@ -69,7 +69,7 @@ impl SettingsWatcher { /// /// Loads initial settings and starts watching the config file for changes. /// Changes are debounced (500ms) to avoid multiple reloads during saves. - pub fn new() -> Result<Self> { + pub(crate) fn new() -> Result<Self> { let initial_settings = Arc::new(Settings::new()?); let (tx, rx) = watch::channel(initial_settings); @@ -89,12 +89,12 @@ impl SettingsWatcher { /// Returns a receiver that will be notified when settings change. /// Use `changed().await` to wait for the next update, then `borrow()` /// to access the current settings. - pub fn subscribe(&self) -> watch::Receiver<Arc<Settings>> { + pub(crate) fn subscribe(&self) -> watch::Receiver<Arc<Settings>> { self.rx.clone() } /// Get the current settings without subscribing to updates. - pub fn current(&self) -> Arc<Settings> { + pub(crate) fn current(&self) -> Arc<Settings> { self.rx.borrow().clone() } |
