Skip to main content

quickfix_tokio/
lib.rs

1//! # quickfix-tokio
2//!
3//! A pure-Rust FIX protocol engine built natively on tokio — no C++
4//! bindings, no blocking threads. Protocol behavior follows the reference
5//! QuickFIX engines (C++, Go, .NET); the concurrency model is one tokio
6//! task per session that owns all session state, with sockets and API
7//! handles connected purely by channels.
8//!
9//! The engine is written entirely in safe Rust (`#![forbid(unsafe_code)]`).
10//!
11//! ```no_run
12//! use std::sync::Arc;
13//! use quickfix_tokio::{Application, Engine, Settings, MemoryStoreFactory, TracingLogFactory};
14//!
15//! struct MyApp;
16//! impl Application for MyApp {}
17//!
18//! # async fn run() -> quickfix_tokio::Result<()> {
19//! let settings = Settings::from_file("fix.cfg").await?;
20//! let engine = Engine::start(
21//!     &settings,
22//!     Arc::new(MyApp),
23//!     Arc::new(MemoryStoreFactory::new()),
24//!     Arc::new(TracingLogFactory),
25//! ).await?;
26//! # Ok(())
27//! # }
28//! ```
29#![forbid(unsafe_code)]
30
31pub mod application;
32pub mod datadictionary;
33pub mod engine;
34#[cfg(feature = "fix44")]
35pub mod fix44;
36#[cfg(feature = "fix50")]
37pub mod fix50;
38#[cfg(feature = "fixt11")]
39pub mod fixt11;
40pub mod error;
41pub mod field_map;
42pub mod log;
43pub mod message;
44pub mod parser;
45pub mod schedule;
46pub mod session;
47pub mod session_id;
48pub mod settings;
49pub mod store;
50pub mod tags;
51#[cfg(feature = "tls")]
52mod tls;
53mod transport;
54pub mod value;
55
56pub use application::{
57    Application, ApplicationError, ChannelApplication, DoNotSend, SessionEvent, event_channel,
58};
59pub use datadictionary::{DataDictionary, ValidationSettings};
60pub use engine::Engine;
61pub use error::{Error, RejectError, Result, SessionRejectReason};
62pub use field_map::{FieldMap, GroupTemplate};
63pub use log::{FileLogFactory, Log, LogFactory, NullLogFactory, Rotation, TracingLogFactory};
64pub use message::{Message, Tag};
65pub use session::{SessionHandle, SessionStatus};
66pub use session_id::SessionId;
67pub use settings::{ConnectionType, SessionConfig, Settings, TlsSettings};
68pub use store::{
69    FileStoreFactory, MemoryStoreFactory, MessageStore, MessageStoreFactory,
70};
71pub use value::{FixDate, TimestampPrecision, UtcTimestamp};
72
73/// The numeric type for FIX float-family fields (Price, Qty, Amt, Float,
74/// Percentage). Exact fixed-point [`rust_decimal::Decimal`] with the
75/// `decimal` feature (default), or `f64` without it. Generated typed
76/// accessors use this alias, so the whole typed API switches with the
77/// feature.
78#[cfg(feature = "decimal")]
79pub type Amount = rust_decimal::Decimal;
80#[cfg(not(feature = "decimal"))]
81pub type Amount = f64;
82
83#[cfg(feature = "decimal")]
84pub use rust_decimal::{Decimal, dec};