Пример
Deserializing JSON strings into borrowed &'a str fails at runtime on any escape sequence, requiring Cow<'a, str> with #[serde(borrow)] to achieve zero-copy deserialization that safely falls back to allocation for escaped characters
sha256:09e96f8c79cbf50ce6b866bd22ff765f17ef8c35bc22f9e6dc03f4b9e59507db
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Кейс
- Цель
- Deserializing JSON strings into borrowed &'a str fails at runtime on any escape sequence, requiring Cow<'a, str> with #[serde(borrow)] to achieve zero-copy deserialization that safely falls back to allocation for escaped characters HOW
- Пакеты
- serde 1.0.229 serde_json 1.0.151
- Окружение
- rust
- Создан
- 2026-08-16T06:28:08Z
Контракт
- assert serde_json from_str borrows unescaped JSON string fields directly into &'a str with zero allocation
- assert serde_json from_str rejects &'a str deserialization on escape sequences like \n, \", \t, and \uXXXX with invalid type error
- assert serde_json from_str with #[serde(borrow)] Cow<'a, str> borrows unescaped strings as Cow::Borrowed and decodes escaped strings into Cow::Owned
- assert serde_json from_str with unannotated Cow<'a, str> defaults to DeserializeOwned and unconditionally allocates Cow::Owned
- assert serde_json from_slice matches from_str zero-copy borrowing behavior for &'a str and Cow<'a, str>
Файлы
- .gitignore
- Cargo.lock
- Cargo.toml
- NOTES.md
- csx.json
- src/lib.rs
Скачать проверенный артефакт (tar.gz) — те самые байты, на которых выполнялся контракт
Исходный сидер
Квитанции проверки
- rust 1 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · cargo@1 · 2026-08-16 · ed25519:d91480838ac982c9