Move 17 library crates into crates/, CLI binary into bin/fxt, consolidate 10 test crates into testing/, split config crate from deployment config files. Root directory reduced from 38+ to ~17 directories. All Cargo.toml paths and build.rs proto refs updated. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
49 lines
1.2 KiB
Rust
49 lines
1.2 KiB
Rust
//! FIX protocol message handling
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
use std::collections::HashMap;
|
|
|
|
/// FIX message structure
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
/// FixMessage
|
|
///
|
|
/// Auto-generated documentation placeholder - enhance with specifics
|
|
pub struct FixMessage {
|
|
/// Msg Type
|
|
pub msg_type: String,
|
|
/// Fields
|
|
pub fields: HashMap<String, String>,
|
|
}
|
|
|
|
impl FixMessage {
|
|
/// Create new FIX message
|
|
pub fn new(msg_type: String) -> Self {
|
|
Self {
|
|
msg_type,
|
|
fields: HashMap::new(),
|
|
}
|
|
}
|
|
|
|
/// Add field to message
|
|
pub fn add_field(&mut self, tag: String, value: String) {
|
|
self.fields.insert(tag, value);
|
|
}
|
|
|
|
/// Get field value
|
|
pub fn get_field(&self, tag: &str) -> Option<&String> {
|
|
self.fields.get(tag)
|
|
}
|
|
}
|
|
|
|
/// Convert FIX message to string representation
|
|
impl ToString for FixMessage {
|
|
fn to_string(&self) -> String {
|
|
let mut result = format!("35={}\u{0001}", self.msg_type);
|
|
for (tag, value) in &self.fields {
|
|
use std::fmt::Write;
|
|
_ = write!(result, "{}={}\u{0001}", tag, value);
|
|
}
|
|
result
|
|
}
|
|
}
|