Skip to content

Commit 3a4c008

Browse files
authored
feat: expose some useful types in hotfix-message (#173)
* Expose some useful types in hotfix-message * Use new helper to construct message configuration with separator
1 parent a16dda7 commit 3a4c008

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

crates/hotfix-message/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ pub use encoding::fix42;
1717
pub use encoding::fix44;
1818
pub use hotfix_derive::FieldType;
1919
pub use hotfix_dictionary::{self as dict, TagU32};
20+
pub use parser::SOH;
2021
pub use parts::{Part, RepeatingGroup};

crates/hotfix-message/src/message.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ pub struct Config {
131131
pub(crate) separator: u8,
132132
}
133133

134+
impl Config {
135+
pub const fn with_separator(separator: u8) -> Self {
136+
Self { separator }
137+
}
138+
}
139+
134140
impl Default for Config {
135141
fn default() -> Self {
136142
Self { separator: SOH }

crates/hotfix-message/src/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ mod tests {
377377
use crate::{Part, fix44};
378378
use hotfix_dictionary::{Dictionary, IsFieldDefinition};
379379

380-
const CONFIG: Config = Config { separator: b'|' };
380+
const CONFIG: Config = Config::with_separator(b'|');
381381

382382
#[test]
383383
fn parse_simple_message() {

0 commit comments

Comments
 (0)