use ratatui::{ buffer::Buffer, layout::Rect, style::Stylize, symbols::border, text::{Line, Text}, widgets::{Block, Paragraph, Widget}, }; use crate::binary_repr::BinaryRepr; #[derive(Debug, Default)] pub struct Unsigned { repr: BinaryRepr, } impl Unsigned { pub fn update(&mut self, input: &BinaryRepr) { self.repr = input.clone(); } } impl Widget for &Unsigned { fn render(self, area: Rect, buf: &mut Buffer) { let input_text = Text::from(self.repr.to_unsigned().yellow()); let input_block = Block::bordered() .title(Line::from("unsigned".bold())) .border_set(border::PLAIN); Paragraph::new(input_text) .block(input_block) .render(area, buf); } }