Commit 405ed60
committed
Don't enforce owned values be written in
When writing legacy TLVs, we use a lambda that returns an `Option`
over a specified type. To avoid implicit type confusion issues, we
explicitly check that that lambda writes an `Option<Type>`.
However, we may wish to occasionally write an `Option<&Type>` to
avoid unnecessary allocations.
Here we replace the explicit type confusion check with a
verification by reading the written contents back explicitly using
the specified Type. This should catch most cases of type confusion
as we will generally end up writing a different number of bytes.legacy TLV writing1 parent df68774 commit 405ed60
1 file changed
+18
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
47 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
48 | 63 | | |
49 | 64 | | |
50 | 65 | | |
| |||
0 commit comments