1
0
mirror of https://github.com/danog/ytop.git synced 2024-11-26 20:15:03 +01:00

replace lazy static with once cell

This commit is contained in:
Caleb Bassi 2020-01-23 09:14:38 -08:00
parent 9301742fb2
commit 39231ceb0a
3 changed files with 10 additions and 11 deletions

8
Cargo.lock generated
View File

@ -560,7 +560,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "once_cell"
version = "1.2.0"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -641,7 +641,7 @@ dependencies = [
"mach 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"nix 0.16.1 (git+https://github.com/nix-rust/nix)",
"num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)",
"once_cell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"once_cell 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"platforms 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"snafu 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1022,9 +1022,9 @@ dependencies = [
"crossterm 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ctrlc 3.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fern 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"num-rational 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"once_cell 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"platform-dirs 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"psutil 1.7.0 (git+https://github.com/borntyping/rust-psutil?branch=macos)",
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1103,7 +1103,7 @@ dependencies = [
"checksum num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c81ffc11c212fa327657cb19dd85eb7419e163b5b076bede2bdb5c974c07e4"
"checksum num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76dac5ed2a876980778b8b85f75a71b6cbf0db0b1232ee12f826bccb00d09d72"
"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef"
"checksum once_cell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "891f486f630e5c5a4916c7e16c4b24a53e78c860b646e9f8e005e4f16847bfed"
"checksum once_cell 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b1c601810575c99596d4afc46f78a678c80105117c379eb3650cf99b8a21ce5b"
"checksum parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92e98c49ab0b7ce5b222f2cc9193fc4efe11c6d0bd4f648e374684a6857b1cfc"
"checksum parking_lot_core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1"
"checksum platform-dirs 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f1e6f10c0c97e3d27b298374c2c67a057216c98e0a86c44df6bcd1f02bacbe38"

View File

@ -13,7 +13,6 @@ crossbeam-channel = "0.4.0"
crossterm = "0.14.1"
ctrlc = { version = "3.1.3", features = ["termination"] }
fern = "0.5.9"
lazy_static = "1.4.0"
log = "0.4.8"
num-rational = "0.2.2"
platform-dirs = "0.2.0"
@ -27,3 +26,4 @@ structopt = "0.3.7"
tui = { git = "https://github.com/cjbassi/tui-rs", branch = "master", features = ["crossterm"] }
backtrace = "0.3.40"
battery = "0.7.5"
once_cell = "1.3.1"

View File

@ -1,4 +1,4 @@
use lazy_static::lazy_static;
use once_cell::sync::Lazy;
use tui::buffer::Buffer;
use tui::layout::Rect;
use tui::widgets::{Paragraph, Text, Widget};
@ -37,12 +37,11 @@ CPU and Mem graph scaling:
const TEXT_WIDTH: u16 = 48;
const TEXT_HEIGHT: u16 = 29;
lazy_static! {
static ref TEXT_VEC: Vec<Text<'static>> = TEXT
.lines()
static TEXT_VEC: Lazy<Vec<Text<'static>>> = Lazy::new(|| {
TEXT.lines()
.map(|line| Text::raw(format!("{}\n", line)))
.collect();
}
.collect()
});
pub struct HelpMenu<'a> {
title: String,