pub struct UnifiedBufferManager { /* private fields */ }Expand description
Unified buffer manager optimized for HFT zero-copy operations
Combines multiple specialized buffer types into a single manager for maximum efficiency in high-frequency trading applications. Eliminates allocation overhead through buffer reuse and provides type-safe access to pre-allocated memory.
§Buffer Specialization
Each buffer type is optimized for specific HFT operations:
- Text: Symbol parsing, string operations
- Binary: Protocol messages, raw data
- JSON Parse: Market data deserialization
- JSON Serialize: Order message creation
- JSON Large: Batch operations, snapshots
- String Format: ID generation, logging
§Usage Pattern
let mut manager = UnifiedBufferManager::new();
manager.process_with_json_buffer(|buffer| {
// Zero-allocation JSON processing
});Implementations§
Source§impl UnifiedBufferManager
impl UnifiedBufferManager
Sourcepub fn text_buffer_mut(&mut self) -> &mut Vec<u8> ⓘ
pub fn text_buffer_mut(&mut self) -> &mut Vec<u8> ⓘ
Returns a mutable reference to the text buffer, clearing it first.
Sourcepub fn binary_buffer_mut(&mut self) -> &mut Vec<u8> ⓘ
pub fn binary_buffer_mut(&mut self) -> &mut Vec<u8> ⓘ
Returns a mutable reference to the binary buffer, clearing it first.
Sourcepub fn json_parse_buffer_mut(&mut self) -> &mut Vec<u8> ⓘ
pub fn json_parse_buffer_mut(&mut self) -> &mut Vec<u8> ⓘ
Returns a mutable reference to the JSON parse buffer, clearing it first.
Sourcepub fn json_serialize_buffer_mut(&mut self) -> &mut Vec<u8> ⓘ
pub fn json_serialize_buffer_mut(&mut self) -> &mut Vec<u8> ⓘ
Returns a mutable reference to the JSON serialize buffer, clearing it first.
Sourcepub fn json_large_buffer_mut(&mut self) -> &mut Vec<u8> ⓘ
pub fn json_large_buffer_mut(&mut self) -> &mut Vec<u8> ⓘ
Returns a mutable reference to the large JSON buffer, clearing it first.
Sourcepub fn string_format_buffer_mut(&mut self) -> &mut String
pub fn string_format_buffer_mut(&mut self) -> &mut String
Returns a mutable reference to the string format buffer, clearing it first.
Sourcepub fn process_with_text_buffer<F, R>(&mut self, processor: F) -> R
pub fn process_with_text_buffer<F, R>(&mut self, processor: F) -> R
Processes a text buffer with a given closure.
Sourcepub fn process_with_binary_buffer<F, R>(&mut self, processor: F) -> R
pub fn process_with_binary_buffer<F, R>(&mut self, processor: F) -> R
Processes a binary buffer with a given closure.
Sourcepub fn process_with_json_buffer<F, R>(&mut self, processor: F) -> R
pub fn process_with_json_buffer<F, R>(&mut self, processor: F) -> R
Processes a JSON buffer with a given closure.
Sourcepub const fn get_stats(&self) -> UnifiedBufferStats
pub const fn get_stats(&self) -> UnifiedBufferStats
Get buffer statistics for monitoring