pub struct WsBookUpdateProcessor { /* private fields */ }Expand description
In-place WS book message processor built on simd-json’s tape API.
This avoids building a DOM (which allocates for arrays/objects) by decoding into a reusable tape, then traversing it to extract the fields needed for order book updates.
Implementations§
Source§impl WsBookUpdateProcessor
impl WsBookUpdateProcessor
Sourcepub fn new(input_len_hint: usize) -> Self
pub fn new(input_len_hint: usize) -> Self
Create a new processor.
input_len_hint should be set to the typical WS message size to reduce warmup reallocs.
Sourcepub fn process_bytes(
&mut self,
bytes: &mut [u8],
books: &OrderBookManager,
) -> Result<WsBookApplyStats>
pub fn process_bytes( &mut self, bytes: &mut [u8], books: &OrderBookManager, ) -> Result<WsBookApplyStats>
Process a WS payload in-place (bytes will be mutated by the JSON parser).
Sourcepub fn process_text(
&mut self,
text: String,
books: &OrderBookManager,
) -> Result<WsBookApplyStats>
pub fn process_text( &mut self, text: String, books: &OrderBookManager, ) -> Result<WsBookApplyStats>
Convenience: process an owned text message without allocating an additional buffer.
Auto Trait Implementations§
impl Freeze for WsBookUpdateProcessor
impl RefUnwindSafe for WsBookUpdateProcessor
impl Send for WsBookUpdateProcessor
impl Sync for WsBookUpdateProcessor
impl Unpin for WsBookUpdateProcessor
impl UnwindSafe for WsBookUpdateProcessor
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more