pub static COOLPROP: LazyLock<Mutex<CoolProp>>Expand description
Global instance of the CoolProp dynamic library.
Provides thread-safe access to a single CoolProp instance across the entire application.
The library is loaded lazily on first access using LazyLock.
Access to this shared handle is protected by a Mutex. This is a conservative boundary
around CoolProp’s process-global configuration, debug level, warning, and pending-error
state. It also allows higher-level wrappers to keep calls returning sentinel values and
subsequent pending-error retrieval together.
To use the library, acquire the lock:
use coolprop_sys::COOLPROP;
let coolprop = COOLPROP.lock().unwrap();
// Use CoolProp methods here§Panics
Panics on initialization if the CoolProp dynamic library cannot be loaded
(e.g., if the library file is missing or corrupted).
§Safety
Internally uses unsafe to load the dynamic library via FFI.
Safety is ensured because:
- The library is loaded from the verified
COOLPROP_PATH - Loading occurs once during initialization
- All subsequent accesses work with the already loaded library