pub struct ConfigWatcher { /* private fields */ }Expand description
ConfigWatcher — watches config sources for changes. ConfigWatcher — 监视配置源的更改。
Supports file modification watching and HTTP polling. Equivalent to Spring Cloud Config’s watch mechanism. 支持文件修改监视和 HTTP 轮询。 等价于 Spring Cloud Config 的监视机制。
Implementations§
Source§impl ConfigWatcher
impl ConfigWatcher
Sourcepub fn new(scope: RefreshScope) -> Self
pub fn new(scope: RefreshScope) -> Self
Create a new config watcher / 创建新配置监视器
Sourcepub fn watch_file(&mut self, path: impl Into<PathBuf>)
pub fn watch_file(&mut self, path: impl Into<PathBuf>)
Add a file to watch / 添加要监视的文件
Sourcepub fn check_changes(&mut self) -> Vec<String>
pub fn check_changes(&mut self) -> Vec<String>
Check for file changes and fire events / 检查文件更改并触发事件
Returns a list of keys that changed (empty if no changes detected). 返回已更改的键列表(如果未检测到更改则为空)。
Sourcepub fn scope(&self) -> &RefreshScope
pub fn scope(&self) -> &RefreshScope
Get the underlying RefreshScope / 获取底层 RefreshScope
Sourcepub fn watched_count(&self) -> usize
pub fn watched_count(&self) -> usize
Get the number of watched files / 获取被监视文件的数量
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConfigWatcher
impl RefUnwindSafe for ConfigWatcher
impl Send for ConfigWatcher
impl Sync for ConfigWatcher
impl Unpin for ConfigWatcher
impl UnsafeUnpin for ConfigWatcher
impl UnwindSafe for ConfigWatcher
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