1use std::io::Cursor;
5
6use crate::ByteSpan;
7use binrw::BinRead;
8use binrw::binrw;
9
10#[binrw]
11#[derive(Debug)]
12#[brw(little)]
13struct UldHeader {
14 #[br(count = 4)]
15 #[bw(pad_size_to = 4)]
16 #[bw(map = |x : &String | x.as_bytes())]
17 #[br(map = | x: Vec<u8> | String::from_utf8(x).unwrap().trim_matches(char::from(0)).to_string())]
18 pub identifier: String,
19
20 #[br(count = 4)]
21 #[bw(pad_size_to = 4)]
22 #[bw(map = |x : &String | x.as_bytes())]
23 #[br(map = | x: Vec<u8> | String::from_utf8(x).unwrap().trim_matches(char::from(0)).to_string())]
24 pub version: String,
25
26 component_offset: u32,
27 widget_offset: u32,
28}
29
30#[derive(Debug)]
31pub struct Uld {}
32
33impl Uld {
34 pub fn from_existing(buffer: ByteSpan) -> Option<Self> {
36 let mut cursor = Cursor::new(buffer);
37 UldHeader::read(&mut cursor).ok()?;
38
39 Some(Uld {})
40 }
41}