Skip to main content

get_extra

Function get_extra 

Source
pub fn get_extra(key: &str) -> Result<Option<Value>, NeuxcfgError>
Expand description

Retrieves a single extra field from the project configuration.

Returns None if the key does not exist.

§Parameters

  • key – The extra field name to look up.

§Errors

Returns NeuxcfgError variants from loading the configuration.

§Examples

use age_setup::config::{init, set_extra, get_extra};
use toml::Value;

init()?;
set_extra("theme", Value::String("dark".into()))?;
let theme = get_extra("theme")?;
assert_eq!(theme, Some(Value::String("dark".into())));