pub fn decode_frame<T: DeserializeOwned>(text: &str) -> Option<WsFrame<T>>Expand description
Decode text into a WsFrame<T> with a single pass of whatever JSON
parser is fastest for its size.
- Small frames:
serde_json::from_stron the&strdirectly — no alloc. - Large frames (≥
SIMD_CROSSOVER_BYTES,simd-jsonfeature on): copy to aVec<u8>once, thensimd_json::serde::from_slicewith SIMD-accelerated tokenisation.
Returns None on parse failure; callers typically log and drop such
frames. Dispatch rule between single and array: first non-whitespace
byte is [ → array; else single object. Matches polymarket / kalshi
WS behaviour (both forms are observed in the wild).