Skip to content

Commit

Permalink
run cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
hellow554 committed Sep 24, 2023
1 parent ba1981d commit 45a1829
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl Default for HexViewConfig {
hex_ascii_separator: " | ",
show_ascii: true,
start_addr: 0,
bytes_per_addr: 0
bytes_per_addr: 0,
}
}
}
Expand Down Expand Up @@ -259,7 +259,6 @@ impl HexView {
self.data = data.into_iter().map(|u| *u.borrow()).collect();
}


/// Modifies start_addr value of instance config during the lifetime.
pub fn set_start_addr(&mut self, addr: usize) {
self.config.start_addr = addr;
Expand Down Expand Up @@ -401,7 +400,10 @@ impl HexView {
fn get_addr_digit_length(&self) -> usize {
match self.data.len() {
0..=1 => 1,
e => std::cmp::max(((e + self.config.start_addr) as f64).log(16.0).ceil() as usize, self.config.bytes_per_addr),
e => std::cmp::max(
((e + self.config.start_addr) as f64).log(16.0).ceil() as usize,
self.config.bytes_per_addr,
),
}
}

Expand Down Expand Up @@ -506,7 +508,11 @@ impl HexView {
for lines in 0..self.get_widget_height() {
printer.print(
(0, lines),
&format!("{:0len$X}", self.config.start_addr + lines * self.config.bytes_per_line, len = digits_len),
&format!(
"{:0len$X}",
self.config.start_addr + lines * self.config.bytes_per_line,
len = digits_len
),
);
}
}
Expand Down

0 comments on commit 45a1829

Please sign in to comment.