Skip to content

Commit 67853ff

Browse files
author
LChen
committed
fix new bitmap
1 parent 3a1bdf1 commit 67853ff

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

dsclient/src/bitmap.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
2-
31
use std::fmt::Display;
42

5-
pub struct Bitmap(pub u128, pub u128);
3+
pub struct Bitmap(u128, u128);
64

75
impl Bitmap {
6+
pub fn new() -> Self {
7+
Bitmap(0, 0)
8+
}
89
pub fn push(&mut self, key: u8) -> bool {
910
if key <= 127 {
1011
// 0-127
@@ -43,7 +44,7 @@ impl Display for Bitmap {
4344

4445
#[test]
4546
fn test() {
46-
let mut bm = Bitmap(0, 0);
47+
let mut bm = Bitmap::new();
4748
assert_eq!(bm.push(0), true);
4849
assert_eq!(bm.push(10), true);
4950
assert_eq!(bm.push(127), true);
@@ -63,5 +64,4 @@ fn test() {
6364

6465
assert_eq!(bm.push(10), true);
6566
assert_eq!(bm.push(168), true);
66-
6767
}

dsclient/src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ fn draw(app: app::App, host: String, pwd: String) {
166166
Err(_) => {}
167167
});
168168
let hooked = Rc::new(RefCell::new(false));
169-
let press_record = Rc::new(RefCell::new(bitmap::Bitmap(0, 0)));
169+
let press_record = Rc::new(RefCell::new(bitmap::Bitmap::new()));
170170
frame.handle(move |f, ev| {
171171
let mut hk = hooked.borrow_mut();
172172
let mut bmap = press_record.borrow_mut();

0 commit comments

Comments
 (0)