Function foundationdb::boot

source ·
pub unsafe fn boot() -> NetworkAutoStop
Expand description

Initialize the FoundationDB Client API, this can only be called once per process.

§Returns

A NetworkAutoStop handle which must be dropped before the program exits.

§Safety

You MUST ensure drop is called on the returned object before the program exits. This is not required if the program is aborted.

This method used to be safe in version 0.4. But because drop on the returned object might not be called before the program exits, it was found unsafe.

§Examples

let network = unsafe { foundationdb::boot() };
// do some interesting things with the API...
drop(network);
#[tokio::main]
async fn main() {
    let network = unsafe { foundationdb::boot() };
    // do some interesting things with the API...
    drop(network);
}