INNER CODE UNIT · Rust

SubscriptionCallback

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

pub type SubscriptionCallback = Arc<dyn Fn(&str, &Setting) + Send + Sync>;

struct Subscription {
    id: SubscriptionId,
    matcher: WildMatch,
    callback: SubscriptionCallback,
}

/// A shareable handle to a configuration store. Cloning is cheap (an `Arc` bump); all clones refer
/// to the same underlying store, so subscriptions and writes made through one clone are visible to
/// the others.
#[derive(Clone)]
pub struct Config(Arc<RwLock<ConfigStore>>);

impl Config {
    /// Creates a config from the given settings schema, backed by a volatile in-memory store.
    ///
    /// `gosub_config` is agnostic of which settings exist: the caller (e.g. the engine) supplies

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…