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
impl ApplicationHandle
pub fn with_app<T: FixApplication>(app: T) -> Self
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 ofFixApplication
§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
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
pub fn bridge_ptr(&self) -> usize
Get the C++ bridge pointer
Trait Implementations§
§impl Default for ApplicationHandle
impl Default for ApplicationHandle
impl Send for ApplicationHandle
Auto Trait Implementations§
impl Freeze for ApplicationHandle
impl !RefUnwindSafe for ApplicationHandle
impl !Sync for ApplicationHandle
impl Unpin for ApplicationHandle
impl !UnwindSafe for ApplicationHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more