Configuration

Struct Configuration 

Source
pub struct Configuration {
    pub simulator_host: String,
    pub connect_timeout: Duration,
    pub pool_size: usize,
}
Expand description

Configuration settings for the RealFlight Link bridge.

The Configuration struct controls how the bridge connects to and communicates with the RealFlight simulator. It provides settings for connection management, timeouts, and performance optimization.

§Connection Pool

The bridge maintains a pool of TCP connections to improve performance when making frequent SOAP requests. The pool size and connection behavior can be tuned using the buffer_size, connect_timeout, and retry_delay parameters.

§Default Configuration

The default configuration is suitable for most local development:

use realflight_bridge::Configuration;
use std::time::Duration;

let default_config = Configuration {
    simulator_host: "127.0.0.1:18083".to_string(),
    connect_timeout: Duration::from_millis(50),
    pool_size: 1,
};

§Examples

Basic configuration for local development:

use realflight_bridge::Configuration;
use std::time::Duration;

let config = Configuration::default();

Configuration optimized for high-frequency control:

use realflight_bridge::Configuration;
use std::time::Duration;

let config = Configuration {
    simulator_host: "127.0.0.1:18083".to_string(),
    connect_timeout: Duration::from_millis(25),  // Faster timeout
    pool_size: 5,                                // Larger connection pool
};

Configuration for a different network interface:

use realflight_bridge::Configuration;
use std::time::Duration;

let config = Configuration {
    simulator_host: "192.168.1.100:18083".to_string(),
    connect_timeout: Duration::from_millis(100), // Longer timeout for network
    pool_size: 2,
};

Fields§

§simulator_host: String

The host where the RealFlight simulator is listening for connections.

§Format

The value should be in the format “host:port”. For local development, this is typically “127.0.0.1:18083”.

§Important Notes

  • The bridge should run on the same machine as RealFlight for best performance
  • Remote connections may experience significant latency due to SOAP overhead
§connect_timeout: Duration

Maximum time to wait when establishing a new TCP connection.

§Performance Impact

  • Lower values improve responsiveness when the simulator is unavailable
  • Too low values may cause unnecessary connection failures
  • Recommended range: 25-100ms for local connections

§Default

5 milliseconds

§pool_size: usize

Size of the connection pool.

The connection pool maintains a set of pre-established TCP connections to improve performance when making frequent requests to the simulator.

§Performance Impact

  • Larger values can improve throughput for frequent state updates
  • Too large values may waste system resources
  • Recommended range: 1-5 connections

§Memory Usage

Each connection in the pool consumes system resources:

  • TCP socket
  • Memory for connection management
  • System file descriptors

§Default

1 connection

Trait Implementations§

Source§

impl Clone for Configuration

Source§

fn clone(&self) -> Configuration

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Configuration

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Configuration

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.