set

Function set 

Source
pub fn set(key: &str, value: &str) -> Result<()>
Expand description

Set a Nix setting.

ยงThread Safety

This function uses a mutex to serialize access through the Rust API. However, the underlying Nix settings system uses global mutable state without internal synchronization.

The mutex provides protection between Rust callers but cannot prevent:

  • C++ Nix code from modifying settings concurrently
  • Other Nix operations from reading settings during modification

For multi-threaded applications, ensure that no other Nix operations are running while changing settings. Settings are best modified during single-threaded initialization.