From c78c8779004d128be528ffada103cadee36c74fc Mon Sep 17 00:00:00 2001 From: kevinsoras Date: Mon, 27 Apr 2026 23:58:11 -0500 Subject: [PATCH] fix(rust-patterns-book): fix ownership move in HFT Rust example --- csharp-book/src/ch01-introduction-and-motivation.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/csharp-book/src/ch01-introduction-and-motivation.md b/csharp-book/src/ch01-introduction-and-motivation.md index 55a762f..59092d8 100644 --- a/csharp-book/src/ch01-introduction-and-motivation.md +++ b/csharp-book/src/ch01-introduction-and-motivation.md @@ -438,9 +438,12 @@ struct HighFrequencyTrader { impl HighFrequencyTrader { fn process_market_data(&mut self, tick: MarketTick) { + // Extract Copy field before moving `tick` into analysis + let price = tick.price; + // Zero allocations, predictable performance let analysis = MarketAnalysis::from(tick); - self.trades.push(Trade::new(analysis.signal(), tick.price)); + self.trades.push(Trade::new(analysis.signal(), price)); // No GC pauses, consistent sub-microsecond latency // Performance guaranteed by type system