We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ecce297 commit 1c7f3e7Copy full SHA for 1c7f3e7
examples/manual_metadata_encoding.rs
@@ -60,8 +60,11 @@ impl MetadataRoundtrip for IndividualMetadata {
60
let md = &md[size..];
61
let md = &md[std::mem::size_of::<usize>()..];
62
let mut phenotypes = vec![];
63
+ // NOTE: production code would want to validate that
64
+ // the remaining number of bytes are correct
65
let chunks = md.chunks_exact(std::mem::size_of::<i32>());
66
for c in chunks {
67
+ // Unwrap b/c the conversion cannot fail b/c the chunk size is correct!
68
let a: [u8; std::mem::size_of::<i32>()] = c.try_into().unwrap();
69
phenotypes.push(i32::from_le_bytes(a));
70
}
0 commit comments