Client

Trait Client 

Source
pub trait Client {
    // Required methods
    fn get_options(&self) -> &ClientOptions;
    fn get_kv_client(&self) -> impl KVClient;
}
Expand description

Client trait defining the interface for a client. Implementors must provide methods to retrieve client options and a key-value client.

§Examples

use rcfe_core::Client;
use rcfe_core::options::client::ClientOptions;
use rcfe_core::kv::KVClient;

struct MyClient;

impl Client for MyClient {
    fn get_options(&self) -> &ClientOptions {
        unimplemented!()
    }
    fn get_kv_client(&self) -> impl KVClient {
        unimplemented!()
    }
}
let my_client = MyClient;
let options = my_client.get_options();
let kv_client = my_client.get_kv_client();

Required Methods§

Source

fn get_options(&self) -> &ClientOptions

Get a reference to the client options.

§Returns

A reference to the ClientOptions.

§Examples
use rcfe_core::Client;
use rcfe_core::options::client::ClientOptions;

struct MyClient;

impl Client for MyClient {
    fn get_options(&self) -> &ClientOptions {
        unimplemented!()
    }
    fn get_kv_client(&self) -> impl KVClient {
        unimplemented!()
    }
}
let my_client = MyClient;
let options = my_client.get_options();
Source

fn get_kv_client(&self) -> impl KVClient

Get the key-value client.

§Returns

An implementation of the KVClient trait.

§Examples
use rcfe_core::Client;
use rcfe_core::options::client::ClientOptions;
use rcfe_core::kv::KVClient;

struct MyClient;

impl Client for MyClient {
    fn get_options(&self) -> &ClientOptions {
        unimplemented!()
    }
    fn get_kv_client(&self) -> impl KVClient {
        unimplemented!()
    }
}
let my_client = MyClient;
let kv_client = my_client.get_kv_client();

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§