INNER CODE UNIT · Rust

subscribe

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

    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)
    }

    /// Reads a boolean setting, returning `false` when the key is unknown or a storage error occurs.
    #[must_use]
    pub fn get_bool(&self, key: &str) -> bool {
        self.typed_get(key, false, Setting::to_bool)
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…