mirror of
https://github.com/imsnif/bandwhich.git
synced 2026-02-09 01:59:18 +08:00
Bump ratatui to 0.24.0 (#327)
This commit is contained in:
62
Cargo.lock
generated
62
Cargo.lock
generated
@@ -28,6 +28,18 @@ dependencies = [
|
||||
"cpufeatures",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.2"
|
||||
@@ -37,6 +49,12 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "allocator-api2"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
|
||||
|
||||
[[package]]
|
||||
name = "android-tzdata"
|
||||
version = "0.1.1"
|
||||
@@ -715,6 +733,16 @@ version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"allocator-api2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.4.1"
|
||||
@@ -924,6 +952,15 @@ version = "0.4.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
|
||||
|
||||
[[package]]
|
||||
name = "lru"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1efa59af2ddfad1854ae27d75009d538d0998b4b2fd47083e743ac1a10e46c60"
|
||||
dependencies = [
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lru-cache"
|
||||
version = "0.1.2"
|
||||
@@ -1392,15 +1429,16 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ratatui"
|
||||
version = "0.23.0"
|
||||
version = "0.24.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e2e4cd95294a85c3b4446e63ef054eea43e0205b1fd60120c16b74ff7ff96ad"
|
||||
checksum = "0ebc917cfb527a566c37ecb94c7e3fd098353516fb4eb6bea17015ade0182425"
|
||||
dependencies = [
|
||||
"bitflags 2.4.1",
|
||||
"cassowary",
|
||||
"crossterm",
|
||||
"indoc",
|
||||
"itertools",
|
||||
"lru",
|
||||
"paste",
|
||||
"strum",
|
||||
"unicode-segmentation",
|
||||
@@ -2288,6 +2326,26 @@ dependencies = [
|
||||
"linked-hash-map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.7.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "686b7e407015242119c33dab17b8f61ba6843534de936d94368856528eae4dcc"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.7.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "020f3dfe25dfc38dfea49ce62d5d45ecdd7f0d8a724fa63eb36b6eba4ec76806"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.38",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "0.6.6"
|
||||
|
||||
@@ -34,7 +34,7 @@ log = "0.4.20"
|
||||
once_cell = "1.18.0"
|
||||
pnet = "0.34.0"
|
||||
pnet_macros_support = "0.34.0"
|
||||
ratatui = "0.23.0"
|
||||
ratatui = "0.24.0"
|
||||
resolv-conf = "0.7.0"
|
||||
simplelog = "0.12.1"
|
||||
thiserror = "1.0.50"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Alignment, Rect},
|
||||
style::{Color, Modifier, Style},
|
||||
terminal::Frame,
|
||||
@@ -42,7 +41,7 @@ pub struct HeaderDetails<'a> {
|
||||
}
|
||||
|
||||
impl<'a> HeaderDetails<'a> {
|
||||
pub fn render(&self, frame: &mut Frame<impl Backend>, rect: Rect) {
|
||||
pub fn render(&self, frame: &mut Frame, rect: Rect) {
|
||||
let bandwidth = self.bandwidth_string();
|
||||
let color = if self.paused {
|
||||
Color::Yellow
|
||||
@@ -63,13 +62,7 @@ impl<'a> HeaderDetails<'a> {
|
||||
self.render_bandwidth(frame, rect, &bandwidth, color);
|
||||
}
|
||||
|
||||
fn render_bandwidth(
|
||||
&self,
|
||||
frame: &mut Frame<impl Backend>,
|
||||
rect: Rect,
|
||||
bandwidth: &str,
|
||||
color: Color,
|
||||
) {
|
||||
fn render_bandwidth(&self, frame: &mut Frame, rect: Rect, bandwidth: &str, color: Color) {
|
||||
let bandwidth_text = Span::styled(
|
||||
bandwidth,
|
||||
Style::default().fg(color).add_modifier(Modifier::BOLD),
|
||||
@@ -95,13 +88,7 @@ impl<'a> HeaderDetails<'a> {
|
||||
format!(" Total {t} (Up / Down): {up} / {down}{paused}")
|
||||
}
|
||||
|
||||
fn render_elapsed_time(
|
||||
&self,
|
||||
frame: &mut Frame<impl Backend>,
|
||||
rect: Rect,
|
||||
elapsed_time: &str,
|
||||
color: Color,
|
||||
) {
|
||||
fn render_elapsed_time(&self, frame: &mut Frame, rect: Rect, elapsed_time: &str, color: Color) {
|
||||
let elapsed_time_text = Span::styled(
|
||||
elapsed_time,
|
||||
Style::default().fg(color).add_modifier(Modifier::BOLD),
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Alignment, Rect},
|
||||
style::{Modifier, Style},
|
||||
terminal::Frame,
|
||||
@@ -22,7 +21,7 @@ const TEXT_WHEN_DNS_SHOWN: &str = " (DNS queries shown).";
|
||||
const TEXT_TAB_TIP: &str = " Use <TAB> to rearrange tables.";
|
||||
|
||||
impl HelpText {
|
||||
pub fn render(&self, frame: &mut Frame<impl Backend>, rect: Rect) {
|
||||
pub fn render(&self, frame: &mut Frame, rect: Rect) {
|
||||
let pause_content = if self.paused {
|
||||
TEXT_WHEN_PAUSED
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Constraint, Direction, Rect},
|
||||
terminal::Frame,
|
||||
};
|
||||
@@ -100,7 +99,7 @@ impl<'a> Layout<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn render(&self, frame: &mut Frame<impl Backend>, rect: Rect, ui_offset: usize) {
|
||||
pub fn render(&self, frame: &mut Frame, rect: Rect, ui_offset: usize) {
|
||||
let (top, app, bottom) = top_app_and_bottom_split(rect);
|
||||
let layout_slots = self.build_layout(app);
|
||||
for i in 0..layout_slots.len() {
|
||||
|
||||
@@ -3,7 +3,6 @@ use std::{collections::HashMap, fmt, iter::FromIterator, net::IpAddr, ops::Index
|
||||
use derivative::Derivative;
|
||||
use itertools::Itertools;
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Constraint, Rect},
|
||||
style::{Color, Style},
|
||||
terminal::Frame,
|
||||
@@ -326,7 +325,7 @@ impl Table {
|
||||
}
|
||||
|
||||
/// See [`Table`] for layout rules.
|
||||
pub fn render(&self, frame: &mut Frame<impl Backend>, rect: Rect) {
|
||||
pub fn render(&self, frame: &mut Frame, rect: Rect) {
|
||||
let (computed_layout, spacer_width) = {
|
||||
// pick the largest possible layout, constrained by the available width
|
||||
let &(_, layout) = self
|
||||
|
||||
@@ -10,7 +10,11 @@
|
||||
|
||||
use std::io;
|
||||
|
||||
use ratatui::{backend::Backend, buffer::Cell, layout::Rect};
|
||||
use ratatui::{
|
||||
backend::{Backend, WindowSize},
|
||||
buffer::Cell,
|
||||
layout::{Rect, Size},
|
||||
};
|
||||
|
||||
pub struct RawTerminalBackend {}
|
||||
|
||||
@@ -46,6 +50,13 @@ impl Backend for RawTerminalBackend {
|
||||
Ok(Rect::new(0, 0, 0, 0))
|
||||
}
|
||||
|
||||
fn window_size(&mut self) -> io::Result<WindowSize> {
|
||||
Ok(WindowSize {
|
||||
columns_rows: Size::default(),
|
||||
pixels: Size::default(),
|
||||
})
|
||||
}
|
||||
|
||||
fn flush(&mut self) -> io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -4,7 +4,11 @@ use std::{
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
|
||||
use ratatui::{backend::Backend, buffer::Cell, layout::Rect};
|
||||
use ratatui::{
|
||||
backend::{Backend, WindowSize},
|
||||
buffer::Cell,
|
||||
layout::{Rect, Size},
|
||||
};
|
||||
|
||||
#[derive(Hash, Debug, PartialEq)]
|
||||
pub enum TerminalEvent {
|
||||
@@ -109,6 +113,16 @@ impl Backend for TestBackend {
|
||||
Ok(Rect::new(0, 0, *terminal_width, *terminal_height))
|
||||
}
|
||||
|
||||
fn window_size(&mut self) -> io::Result<WindowSize> {
|
||||
let width = *self.terminal_width.lock().unwrap();
|
||||
let height = *self.terminal_height.lock().unwrap();
|
||||
|
||||
Ok(WindowSize {
|
||||
columns_rows: Size { width, height },
|
||||
pixels: Size::default(),
|
||||
})
|
||||
}
|
||||
|
||||
fn flush(&mut self) -> io::Result<()> {
|
||||
self.events.lock().unwrap().push(TerminalEvent::Flush);
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user