ApplicationHandle

Struct ApplicationHandle 

pub struct ApplicationHandle { /* private fields */ }
Expand description

Handle for a registered application bridge

This handle manages the lifetime of both the C++ RustApplicationBridge and the Rust FixApplication trait object. The bridge receives callbacks from the FIX engine and forwards them to the trait methods.

§Example

use fixantenna_bindings::{ApplicationHandle, FixApplication, FixMessage, Session};

struct MyApp;

impl FixApplication for MyApp {
    fn process(&mut self, msg: &FixMessage, _session: &Session) -> bool {
        println!("Received message");
        true
    }
}

// Create handle with custom application
let handle = ApplicationHandle::with_app(MyApp);

// Or use default (accepts all messages)
let handle = ApplicationHandle::new();

Implementations§

§

impl ApplicationHandle

pub fn with_app<T: FixApplication>(app: T) -> Self

Create a new ApplicationHandle with a custom FixApplication

This creates a C++ RustApplicationBridge that will forward callbacks to the provided FixApplication trait object.

§Arguments
  • app - Your implementation of FixApplication
§Example
use fixantenna_bindings::{ApplicationHandle, FixApplication, FixMessage, Session, LogonEvent, SessionIdWrapper, logon_action};

struct EchoApp;

impl FixApplication for EchoApp {
    fn process(&mut self, msg: &FixMessage, session: &Session) -> bool {
        session.put(msg).is_ok()
    }
    fn on_logon(&mut self, event: &mut LogonEvent, _sid: &SessionIdWrapper) {
        event.set_logon_action(logon_action::ACCEPT_WITH_CONFIRM_LOGON);
    }
}

let handle = ApplicationHandle::with_app(EchoApp);

pub fn new() -> Self

Create a new ApplicationHandle with default behavior

Uses the default FixApplication implementation which:

  • Accepts all incoming messages (returns true from process)
  • Accepts all logons with confirmation
  • Does not reconnect on logout
  • Allows all resends

pub fn bridge_ptr(&self) -> usize

Get the C++ bridge pointer

Trait Implementations§

§

impl Default for ApplicationHandle

§

fn default() -> Self

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

impl Drop for ApplicationHandle

§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

impl Send for ApplicationHandle

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.