Async key access
The async feature adds key-level methods that read and write through Tokio. Enable it as shown in the async I/O introduction. The key paths and value types work like the sync key API.
String values
set_async() writes a string value and preserves other keys in the file. get_async() reads the key as a string. Use dot-separated paths for nested keys.
cfg.set_async("user.name", "tayo").await?;
let name = cfg.get_async("user.name").await?;Typed values
set_val_async() stores a Serde-compatible value in its native configuration type. get_as_async() deserializes a key into the Rust type you request.
cfg.set_val_async("server.port", 8080u16).await?;
let port: u16 = cfg.get_as_async("server.port").await?;With with_env_prefix(), matching environment variables still win on reads. Writes still change the file only. The environment guide explains how _ and __ map to keys.
Keys in a ConfigStack
ConfigStack has the same four async key methods. Reads use the resolved view of every layer plus environment overrides. Writes use only the source named by write_to().
For complete structs, use async loading and saving.