diff options
author | ClementTsang <cjhtsang@uwaterloo.ca> | 2022-04-26 17:28:05 -0400 |
---|---|---|
committer | ClementTsang <cjhtsang@uwaterloo.ca> | 2022-04-28 01:40:10 -0400 |
commit | f68acc5c9d5f58f0ee56d1cacc1d8f0cc9c84616 (patch) | |
tree | dbdddbbddb7236f75ba820883b301276170f8064 /src/canvas/widgets/mem_basic.rs | |
parent | b9a356f58128608418fc4dfe270e367e08e8582d (diff) |
refactor: remove trait usage in component drawing
When I was newer to Rust, I got the weird impression that you couldn't
add functionality to a struct outside of the defining file without using
a trait.
That's obviously not true, so it's high time I got rid of it and just
made it part of the impl of the class itself, rather than declaring a
trait and then exporting/importing it.
Diffstat (limited to 'src/canvas/widgets/mem_basic.rs')
-rw-r--r-- | src/canvas/widgets/mem_basic.rs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/canvas/widgets/mem_basic.rs b/src/canvas/widgets/mem_basic.rs index cecb7b52..16d79572 100644 --- a/src/canvas/widgets/mem_basic.rs +++ b/src/canvas/widgets/mem_basic.rs @@ -13,14 +13,8 @@ use tui::{ widgets::{Block, Paragraph}, }; -pub trait MemBasicWidget { - fn draw_basic_memory<B: Backend>( - &self, f: &mut Frame<'_, B>, app_state: &mut App, draw_loc: Rect, widget_id: u64, - ); -} - -impl MemBasicWidget for Painter { - fn draw_basic_memory<B: Backend>( +impl Painter { + pub fn draw_basic_memory<B: Backend>( &self, f: &mut Frame<'_, B>, app_state: &mut App, draw_loc: Rect, widget_id: u64, ) { let mem_data: &[(f64, f64)] = &app_state.canvas_data.mem_data; |