INNER CODE UNIT · Rust

get_info

gosub-io/gosub-engine · crates/gosub_config/src/lib.rs:196

    pub fn get_info(&self, key: &str) -> Option<SettingInfo> {
        self.0.read().get_info(key)
    }

    /// Subscribes to changes on settings whose key matches `pattern` (a [`WildMatch`] pattern, so
    /// `*`/`?` wildcards work, e.g. `dns.*` or `*`). The callback fires whenever a matching
    /// setting's value actually changes via `set` or `remove`. Returns an id used to unsubscribe.
    pub fn subscribe<F>(&self, pattern: &str, callback: F) -> SubscriptionId
    where
        F: Fn(&str, &Setting) + Send + Sync + 'static,
    {
        self.0.write().subscribe(pattern, callback)
    }

    /// Removes a previously registered subscription. Returns true when a subscription was removed.
    pub fn unsubscribe(&self, id: SubscriptionId) -> bool {
        self.0.write().unsubscribe(id)
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…