aboutsummaryrefslogtreecommitdiffstats
path: root/crates/turtle/src/atuin_client/settings
diff options
context:
space:
mode:
Diffstat (limited to 'crates/turtle/src/atuin_client/settings')
-rw-r--r--crates/turtle/src/atuin_client/settings/meta.rs4
-rw-r--r--crates/turtle/src/atuin_client/settings/watcher.rs10
2 files changed, 7 insertions, 7 deletions
diff --git a/crates/turtle/src/atuin_client/settings/meta.rs b/crates/turtle/src/atuin_client/settings/meta.rs
index 450d0432..cc5afcf7 100644
--- a/crates/turtle/src/atuin_client/settings/meta.rs
+++ b/crates/turtle/src/atuin_client/settings/meta.rs
@@ -1,8 +1,8 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize, Clone)]
-pub struct Settings {
- pub db_path: String,
+pub(crate) struct Settings {
+ pub(crate) db_path: String,
}
impl Default for Settings {
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()
}