pub struct Network(_);
Expand description

The FoundationDB client library performs most tasks on a singleton thread (which usually will be a different thread than your application runs on).

These functions are used to configure, start and stop the FoundationDB event loop on this thread.

NOTE Networks may only be constructed from an initalized fdb_api::FdbApi

Implementations§

Must be called before any asynchronous functions in this API can be expected to complete.

Unless your program is entirely event-driven based on results of asynchronous functions in this API and has no event loop of its own, you will want to invoke this function on an auxiliary thread (which it is your responsibility to create).

This function will not return until Network::stop is called by you or a serious error occurs. You must not invoke run concurrently or reentrantly while it is already running.

Waits for run to have started

Signals the event loop invoked by Network::run to terminate.

You must call this function and wait for fdb_run_network() to return before allowing your program to exit, or else the behavior is undefined.

Example
use std::thread;
use foundationdb;

let network = foundationdb::init().expect("failed to initialize Fdb");

let handle = std::thread::spawn(move || {
    let error = network.run();

    if let Err(error) = error {
        panic!("fdb_run_network: {}", error);
    }
});

network.wait();

// do some interesting things with the API...

network.stop().expect("failed to stop network");
handle.join().expect("failed to join fdb thread");

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.