Skip to content

Instantly share code, notes, and snippets.

View jeremie-j's full-sized avatar
💻

Jérémie jeremie-j

💻
  • Paris
View GitHub Profile
@jeremie-j
jeremie-j / read_bytes_to_stuct.rs
Created December 25, 2023 22:28
Read raw bytes to a struct
use std::io::Read;
use std::{mem, slice};
#[repr(C, packed)]
#[derive(Debug, Copy, Clone)]
struct TextStruct {
u8_number: u8,
u16_number: u16,
utf_8_string: [u8; 7],
}