INNER CODE UNIT · Rust

get_float

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

    pub fn get_float(&self, key: &str) -> f64 {
        self.typed_get(key, 0.0, Setting::to_float)
    }

    /// Reads a string setting, returning an empty string on unknown key or storage error.
    #[must_use]
    pub fn get_string(&self, key: &str) -> String {
        self.typed_get(key, String::new(), Setting::to_string)
    }

    /// Reads a map setting, returning an empty vector on unknown key or storage error.
    #[must_use]
    pub fn get_map(&self, key: &str) -> Vec<String> {
        self.typed_get(key, Vec::new(), Setting::to_map)
    }

    /// Shared helper for the typed getters: reads the setting, applies `convert`, or returns
    /// `default` when the key is unknown (logging on a storage error).

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…