FixEngine

Struct FixEngine 

pub struct FixEngine;
Expand description

Rust wrapper for Engine::FixEngine

This is a safe wrapper around the C++ FixEngine singleton. The FixEngine manages the lifecycle of the FIX engine and sessions.

Implementations§

§

impl FixEngine

pub fn new(properties_file: &str) -> Result<Self, String>

Initialize FixEngine with a properties file

§Arguments
  • properties_file - Path to the properties file
§Returns
  • Ok(FixEngine) if initialization succeeds
  • Err(String) with error message if initialization fails
§Example
use fixantenna_bindings::FixEngine;

let engine = FixEngine::new("engine.properties")
    .expect("Failed to initialize FixEngine");

pub fn new_default() -> Result<Self, String>

Initialize FixEngine with default properties file (“./engine.properties”)

§Returns
  • Ok(FixEngine) if initialization succeeds
  • Err(String) with error message if initialization fails
§Example
use fixantenna_bindings::FixEngine;

let engine = FixEngine::new_default()
    .expect("Failed to initialize FixEngine");

pub fn is_initialized() -> bool

Check if FixEngine is initialized

§Returns
  • true if the engine is initialized
  • false otherwise

pub fn get_listen_port(&self) -> i32

Get the listen port number

§Returns
  • Port number if the engine is initialized and has a listen port
  • 0 if the engine is not initialized or has no listen port

pub fn get_configured_sessions_list(&self) -> Vec<SessionIdWrapper>

Get list of configured sessions from properties

§Returns
  • Vector of SessionIdWrapper objects configured in the properties file
  • Empty vector if the engine is not initialized
§Example
use fixantenna_bindings::FixEngine;

let engine = FixEngine::new_default().unwrap();
let sessions = engine.get_configured_sessions_list();
for session in sessions {
    println!("Session: {} -> {}", session.sender, session.target);
}

pub fn create_session( &self, session_id: &SessionIdWrapper, fix_version: &str, app_version: Option<&str>, ) -> Result<Session, String>

Create a new FIX session

§Arguments
  • session_id - SessionId with sender/target comp IDs
  • fix_version - FIX protocol version (“FIX40”, “FIX41”, “FIX42”, “FIX43”, “FIX44”, “FIXT11”)
  • app_version - Optional application version for FIXT.1.1 (“FIX50”, “FIX50SP1”, etc.)
§Returns

Session wrapper that owns the C++ Session object

§Example
use fixantenna_bindings::{FixEngine, SessionIdWrapper};

let engine = FixEngine::new_default().unwrap();
let session_id = SessionIdWrapper::new("SENDER".to_string(), "TARGET".to_string(), "".to_string());
let session = engine.create_session(&session_id, "FIX44", None)
    .expect("Failed to create session");

Trait Implementations§

§

impl Drop for FixEngine

§

fn drop(&mut self)

Destroy the FixEngine singleton when the Rust wrapper is dropped

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> 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, 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.