ds_rom/rom/
library_entry.rs1use std::fmt::Display;
2
3pub struct LibraryEntry<'a> {
5 address: u32,
6 version_string: &'a str,
7}
8
9impl<'a> LibraryEntry<'a> {
10 pub fn new(address: u32, version_string: &'a str) -> Self {
12 Self { address, version_string }
13 }
14
15 pub fn address(&self) -> u32 {
17 self.address
18 }
19
20 pub fn version_string(&self) -> &'a str {
22 self.version_string
23 }
24
25 pub fn display(&'a self, indent: usize) -> DisplayLibraryEntry<'a> {
27 DisplayLibraryEntry { entry: self, indent }
28 }
29}
30
31pub struct DisplayLibraryEntry<'a> {
33 entry: &'a LibraryEntry<'a>,
34 indent: usize,
35}
36
37impl Display for DisplayLibraryEntry<'_> {
38 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
39 let i = " ".repeat(self.indent);
40 writeln!(f, "{i}Address .......... : {:#010x}", self.entry.address)?;
41 writeln!(f, "{i}Version string ... : {}", self.entry.version_string)?;
42 Ok(())
43 }
44}