odbc_api

Function environment

Source
pub fn environment() -> Result<&'static Environment, Error>
Expand description

An ODBC Environment with static lifetime. This function always returns a reference to the same instance. The environment is constructed then the function is called for the first time. Every time after the initial construction this function must succeed.

Useful if your application uses ODBC for the entirety of its lifetime, since using a static lifetime means there is one less lifetime you and the borrow checker need to worry about. If your application only wants to use odbc for part of its runtime, you may want to use Environment directly in order to explicitly free its associated resources earlier. No matter the application, it is recommended to only have one Environment per process.