TGViewer
Блог* Блог* @dereference_pointer_there · 1.99K subscribers
Post #10602 994
#prog #rust #serde

serde's borrowing can be treacherous

(This is not super surprising when you think about it, but it bit me recently so I figured I'd write it up.)

TL;DR: Be careful when using &'a str or &'a [u8] with serde deserializers; serde has no way to produce an appropriate compile-time error when zero-copy deserialization isn't possible or just isn't supported. Instead, you'll get a runtime error indefinitely later.

Из-за экранирования данных, главным образом. Для обхода этой проблемы можно использовать Cow<'a, str> с #[serde(borrow)]
More from @dereference_pointer_there
  1. Oct 11, 2026Не пытайтесь
  2. Oct 11, 2026#prog #ml #meme
  3. Oct 11, 2026#meme
  4. Oct 10, 2026#prog #article HTTP is not simple От Daniel Stenberg, автора curl
  5. Oct 10, 2026#article RISC-V: They Should Have Known Better Несколько эмоциональная статья о недостатка…
  6. Oct 9, 2026#prog #rust #meme Было в r/rustjerk, но сначала выложили в r/ClaudeCode
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →