File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -207,12 +207,10 @@ let buffer = [
207
207
0x4441_5733 ,
208
208
0x362D_3136 ,
209
209
];
210
- let Ok (message ) = UmpMessage :: try_from (& buffer [.. ]) else {
211
- panic! ();
212
- };
210
+ let message = UmpMessage :: try_from (& buffer [.. ]). expect (" Valid data" );
213
211
```
214
212
215
- Of course this means that such borrowed messages are imutable
213
+ Of course this means that such borrowed messages are immutable
216
214
and also have their lifetimes tied to the original buffer.
217
215
218
216
To remedy this messages can be ` rebuffered ` into a different
@@ -226,12 +224,12 @@ use midi2::{
226
224
227
225
let mut owned : NoteOn :: <[u32 ; 4]> = {
228
226
let buffer = [0x4898_5E03_u32 , 0x6A14_E98A ];
229
- // the borrowed message is imutable and cannot outlive `buffer`
227
+ // the borrowed message is immutable and cannot outlive `buffer`
230
228
let borrowed = NoteOn :: try_from (& buffer [.. ]). expect (" Data is valid" );
231
229
borrowed . try_rebuffer_into (). expect (" Buffer is large enough" )
232
230
};
233
231
234
- // the owned message is mutable an liberated from the buffer lifetime.
232
+ // the owned message is mutable and liberated from the buffer lifetime.
235
233
owned . set_channel (u4 :: new (0x9 ));
236
234
assert_eq! (owned . data (), & [0x4899_5E03 , 0x6A14_E98A ])
237
235
```
You can’t perform that action at this time.
0 commit comments