amethyst / amethyst/serde-diff

Apply Option difference to `None` target doesn't work as expected

オープン
#28 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Rust
スター
127
フォーク
21
PR マージ指標
30日以内にマージされた PR はありません

説明

#### Example to reproduce the issue

```
use serde::{Deserialize, Serialize};
use serde_diff::{Apply, Diff, SerdeDiff};

#[derive(SerdeDiff, Serialize, Deserialize, PartialEq, Debug, Clone)]
struct TestStruct {
a: Option,
}

fn main() {
let old = TestStruct { a: Some(5) };
let new = TestStruct { a: Some(10) };
let mut target = TestStruct { a: None };
let expected = new.clone();

let diff = Diff::serializable(&old, &new);
let json_diff = serde_json::to_string(&diff).unwrap();
let mut deserializer = serde_json::Deserializer::from_str(&json_diff);

Apply::apply(&mut deserializer, &mut target).unwrap();

assert_eq!(target, expected);
}
```

#### Expected result

For target to equal `TestStruct { a: Some(10) }`

#### Actual result

Target equals `TestStruct { a: None }`

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。