Files
binocle/src/unsigned.rs
T
surv 0a3ddbdcaf
CI / fmt (push) Has been cancelled
CI / clippy (push) Has been cancelled
CI / doc (push) Has been cancelled
CI / test macos-latest (push) Has been cancelled
CI / test windows-latest (push) Has been cancelled
First commit
2026-07-31 22:31:23 +02:00

36 lines
778 B
Rust

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);
}
}