| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{ |
| 2 | borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#, |
| 3 | hashrust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/::{Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#, Hasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hasher#}, |
| 4 | timerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/::{Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#, Instantrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/Instant#}, |
| 5 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#, |
| 6 | }; |
| 7 | |
| 8 | use rustc_hashrust-analyzer cargo rustc-hash 2.1.3 crate/::FxHashMaprust-analyzer cargo rustc-hash 2.1.3 FxHashMap#; |
| 9 | |
| 10 | use superrust-analyzer cargo bottom 0.14.9 app/data/::{ProcessDatarust-analyzer cargo bottom 0.14.9 app/data/process/ProcessData#, TimeSeriesDatarust-analyzer cargo bottom 0.14.9 app/data/time_series/TimeSeriesData#}; |
| 11 | #[cfg(feature = "battery")] |
| 12 | use craterust-analyzer cargo bottom 0.14.9 crate/::collectionrust-analyzer cargo bottom 0.14.9 collection/::batteriesrust-analyzer cargo bottom 0.14.9 collection/batteries/; |
| 13 | use craterust-analyzer cargo bottom 0.14.9 crate/::{ |
| 14 | apprust-analyzer cargo bottom 0.14.9 app/::{AppConfigFieldsrust-analyzer cargo bottom 0.14.9 app/AppConfigFields#, DataFiltersrust-analyzer cargo bottom 0.14.9 app/DataFilters#, filterrust-analyzer cargo bottom 0.14.9 app/filter/::Filterrust-analyzer cargo bottom 0.14.9 app/filter/Filter#, layout_managerrust-analyzer cargo bottom 0.14.9 app/layout_manager/::UsedWidgetsrust-analyzer cargo bottom 0.14.9 app/layout_manager/UsedWidgets#}, |
| 15 | collectionrust-analyzer cargo bottom 0.14.9 collection/::{ |
| 16 | Datarust-analyzer cargo bottom 0.14.9 collection/Data#, |
| 17 | cpurust-analyzer cargo bottom 0.14.9 collection/cpu/::{CpuHarvestrust-analyzer cargo bottom 0.14.9 collection/cpu/CpuHarvest#, LoadAvgHarvestrust-analyzer cargo bottom 0.14.9 collection/cpu/LoadAvgHarvest#}, |
| 18 | disksrust-analyzer cargo bottom 0.14.9 collection/disks/::{DiskHarvestrust-analyzer cargo bottom 0.14.9 collection/disks/DiskHarvest#, IoHarvestrust-analyzer cargo bottom 0.14.9 collection/disks/IoHarvest#}, |
| 19 | memoryrust-analyzer cargo bottom 0.14.9 collection/memory/::MemDatarust-analyzer cargo bottom 0.14.9 collection/memory/MemData#, |
| 20 | networkrust-analyzer cargo bottom 0.14.9 collection/network/::NetworkHarvestrust-analyzer cargo bottom 0.14.9 collection/network/NetworkHarvest#, |
| 21 | }, |
| 22 | utilsrust-analyzer cargo bottom 0.14.9 utils/::data_unitsrust-analyzer cargo bottom 0.14.9 utils/data_units/::DataUnitrust-analyzer cargo bottom 0.14.9 utils/data_units/DataUnit#, |
| 23 | widgetsrust-analyzer cargo bottom 0.14.9 widgets/::{DiskWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/disk_table/DiskWidgetData#, TempWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/temperature_table/TempWidgetData#}, |
| 24 | }; |
| 25 | |
| 26 | /// Because otherwise you can't do lookups for something like `(String, String)` as a key. |
| 27 | trait PairKeyrust-analyzer cargo bottom 0.14.9 app/data/store/PairKey# { |
| 28 | fn pairrust-analyzer cargo bottom 0.14.9 app/data/store/PairKey#pair().(&self) -> (&str, &str); |
| 29 | } |
| 30 | |
| 31 | impl PairKeyrust-analyzer cargo bottom 0.14.9 app/data/store/PairKey# for (Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) { |
| 32 | fn pairrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[`(String, String)`][PairKey]pair().(&self) -> (&str, &str) { |
| 33 | (&self.0, &self.1) |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | impl PairKeyrust-analyzer cargo bottom 0.14.9 app/data/store/PairKey# for (&str, &str) { |
| 38 | fn pairrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[`(&str, &str)`][PairKey]pair().(&self) -> (&str, &str) { |
| 39 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | impl<'a> Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<dyn PairKeyrust-analyzer cargo bottom 0.14.9 app/data/store/PairKey# + 'a> for (Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) { |
| 44 | fn borrowrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[`(String, String)`][`Borrow<dyn PairKey + 'a>`]borrow().(&self) -> &(dyn PairKeyrust-analyzer cargo bottom 0.14.9 app/data/store/PairKey# + 'a) { |
| 45 | self |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | impl Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash# for dyn PairKeyrust-analyzer cargo bottom 0.14.9 app/data/store/PairKey# + '_ { |
| 50 | fn hashrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[`dyn PairKey`][Hash]hash().<H: Hasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hasher#>(&self, state: &mut H) { |
| 51 | self.pairrust-analyzer cargo bottom 0.14.9 app/data/store/PairKey#pair().().hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/impls/impl#[`(T, B)`][Hash]hash().(state) |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | impl PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# for dyn PairKeyrust-analyzer cargo bottom 0.14.9 app/data/store/PairKey# + '_ { |
| 56 | fn eqrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[`dyn PairKey`][`PartialEq<Self>`]eq().(&self, other: &Selfrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[`dyn PairKey`][`PartialEq<Self>`]) -> bool { |
| 57 | self.pairrust-analyzer cargo bottom 0.14.9 app/data/store/PairKey#pair().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core tuple/impl#[`(U, T)`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core tuple/impl#[`(U, T)`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core tuple/impl#[`(U, T)`][`PartialEq<Self>`]eq().other.pairrust-analyzer cargo bottom 0.14.9 app/data/store/PairKey#pair().() |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | impl Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq# for dyn PairKeyrust-analyzer cargo bottom 0.14.9 app/data/store/PairKey# + '_ {} |
| 62 | |
| 63 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 64 | pub struct TotalNetworkDatarust-analyzer cargo bottom 0.14.9 app/data/store/TotalNetworkData# { |
| 65 | total_rxrust-analyzer cargo bottom 0.14.9 app/data/store/TotalNetworkData#total_rx.: u64, |
| 66 | total_txrust-analyzer cargo bottom 0.14.9 app/data/store/TotalNetworkData#total_tx.: u64, |
| 67 | } |
| 68 | |
| 69 | /// A collection of data. This is where we dump data into. |
| 70 | /// |
| 71 | /// TODO: Maybe reduce visibility of internal data, make it only accessible |
| 72 | /// through DataStore? |
| 73 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 74 | pub struct InnerDatarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData# { |
| 75 | // FIXME: (points_rework_v1) we could be able to remove this with some more refactoring. |
| 76 | last_update_timerust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#last_update_time.: Instantrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/Instant#, |
| 77 | |
| 78 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) time_series_datarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#time_series_data.: TimeSeriesDatarust-analyzer cargo bottom 0.14.9 app/data/time_series/TimeSeriesData#, |
| 79 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) network_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#network_harvest.: NetworkHarvestrust-analyzer cargo bottom 0.14.9 collection/network/NetworkHarvest#, |
| 80 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) ram_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#ram_harvest.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<MemDatarust-analyzer cargo bottom 0.14.9 collection/memory/MemData#>, |
| 81 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) swap_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#swap_harvest.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<MemDatarust-analyzer cargo bottom 0.14.9 collection/memory/MemData#>, |
| 82 | #[cfg(not(target_os = "windows"))] |
| 83 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) cache_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#cache_harvest.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<MemDatarust-analyzer cargo bottom 0.14.9 collection/memory/MemData#>, |
| 84 | #[cfg(feature = "zfs")] |
| 85 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) arc_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#arc_harvest.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<MemDatarust-analyzer cargo bottom 0.14.9 collection/memory/MemData#>, |
| 86 | #[cfg(feature = "gpu")] |
| 87 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) gpu_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#gpu_harvest.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, MemDatarust-analyzer cargo bottom 0.14.9 collection/memory/MemData#)>, |
| 88 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) cpu_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#cpu_harvest.: CpuHarvestrust-analyzer cargo bottom 0.14.9 collection/cpu/CpuHarvest#, |
| 89 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) load_avg_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#load_avg_harvest.: LoadAvgHarvestrust-analyzer cargo bottom 0.14.9 collection/cpu/LoadAvgHarvest#, |
| 90 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) process_datarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#process_data.: ProcessDatarust-analyzer cargo bottom 0.14.9 app/data/process/ProcessData#, |
| 91 | /// TODO: (points_rework_v1) Might be a better way to do this without having |
| 92 | /// to store here? |
| 93 | prev_iorust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#prev_io.: FxHashMaprust-analyzer cargo rustc-hash 2.1.3 FxHashMap#<(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), (u64, u64)>, |
| 94 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) disk_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#disk_harvest.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<DiskWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/disk_table/DiskWidgetData#>, |
| 95 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) temp_datarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#temp_data.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<TempWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/temperature_table/TempWidgetData#>, |
| 96 | #[cfg(feature = "battery")] |
| 97 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) battery_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#battery_harvest.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<batteriesrust-analyzer cargo bottom 0.14.9 collection/batteries/::BatteryDatarust-analyzer cargo bottom 0.14.9 collection/batteries/BatteryData#>, |
| 98 | |
| 99 | /// Used if we are zeroing out the network data. |
| 100 | starting_total_networkrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#starting_total_network.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<TotalNetworkDatarust-analyzer cargo bottom 0.14.9 app/data/store/TotalNetworkData#>, |
| 101 | } |
| 102 | |
| 103 | impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for InnerDatarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData# { |
| 104 | fn defaultrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[InnerData][Default]default().() -> Selfrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[InnerData][Default] { |
| 105 | InnerDatarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData# { |
| 106 | last_update_timerust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#last_update_time.: Instantrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/Instant#::nowrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[Instant]now().(), |
| 107 | time_series_datarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#time_series_data.: TimeSeriesDatarust-analyzer cargo bottom 0.14.9 app/data/time_series/TimeSeriesData#::defaultrust-analyzer cargo bottom 0.14.9 app/data/time_series/impl#[TimeSeriesData][Default]default().(), |
| 108 | network_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#network_harvest.: NetworkHarvestrust-analyzer cargo bottom 0.14.9 collection/network/NetworkHarvest#::defaultrust-analyzer cargo bottom 0.14.9 collection/network/impl#[NetworkHarvest][Default]default().(), |
| 109 | ram_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#ram_harvest.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 110 | #[cfg(not(target_os = "windows"))] |
| 111 | cache_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#cache_harvest.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 112 | swap_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#swap_harvest.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 113 | cpu_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#cpu_harvest.: CpuHarvestrust-analyzer cargo bottom 0.14.9 collection/cpu/CpuHarvest#::defaultrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`][Default]default().(), |
| 114 | load_avg_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#load_avg_harvest.: LoadAvgHarvestrust-analyzer cargo bottom 0.14.9 collection/cpu/LoadAvgHarvest#::defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; _]`][Default]default().(), |
| 115 | process_datarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#process_data.: Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo bottom 0.14.9 app/data/process/impl#[ProcessData][Default]default().(), |
| 116 | prev_iorust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#prev_io.: FxHashMaprust-analyzer cargo rustc-hash 2.1.3 FxHashMap#::defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S>`][Default]default().(), |
| 117 | disk_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#disk_harvest.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::defaultrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`][Default]default().(), |
| 118 | temp_datarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#temp_data.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::defaultrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`][Default]default().(), |
| 119 | #[cfg(feature = "battery")] |
| 120 | battery_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#battery_harvest.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::defaultrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`][Default]default().(), |
| 121 | #[cfg(feature = "zfs")] |
| 122 | arc_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#arc_harvest.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 123 | #[cfg(feature = "gpu")] |
| 124 | gpu_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#gpu_harvest.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::defaultrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`][Default]default().(), |
| 125 | starting_total_networkrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#starting_total_network.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | impl InnerDatarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData# { |
| 131 | #[allow( |
| 132 | clippy::boxed_local, |
| 133 | reason = "This avoids warnings on certain platforms (e.g. 32-bit)." |
| 134 | )] |
| 135 | fn eat_datarust-analyzer cargo bottom 0.14.9 app/data/store/impl#[InnerData]eat_data().( |
| 136 | &mut self, mut data: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<Datarust-analyzer cargo bottom 0.14.9 collection/Data#>, settings: &AppConfigFieldsrust-analyzer cargo bottom 0.14.9 app/AppConfigFields#, used_widgets: &UsedWidgetsrust-analyzer cargo bottom 0.14.9 app/layout_manager/UsedWidgets#, |
| 137 | filters: &DataFiltersrust-analyzer cargo bottom 0.14.9 app/DataFilters#, |
| 138 | ) { |
| 139 | let harvested_time = data.collection_timerust-analyzer cargo bottom 0.14.9 collection/Data#collection_time.; |
| 140 | |
| 141 | // We must adjust all the network values to their selected type (defaults to |
| 142 | // bits). |
| 143 | if matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(settings.network_unit_typerust-analyzer cargo bottom 0.14.9 app/AppConfigFields#network_unit_type., DataUnitrust-analyzer cargo bottom 0.14.9 utils/data_units/DataUnit#::Byterust-analyzer cargo bottom 0.14.9 utils/data_units/DataUnit#Byte#) |
| 144 | && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(network) = &mut data.networkrust-analyzer cargo bottom 0.14.9 collection/Data#network. |
| 145 | { |
| 146 | network.rxrust-analyzer cargo bottom 0.14.9 collection/network/NetworkHarvest#rx. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`DivAssign<Self>`]div_assign()./=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`DivAssign<Self>`]div_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`DivAssign<Self>`]div_assign().8; |
| 147 | network.txrust-analyzer cargo bottom 0.14.9 collection/network/NetworkHarvest#tx. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`DivAssign<Self>`]div_assign()./=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`DivAssign<Self>`]div_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`DivAssign<Self>`]div_assign().8; |
| 148 | } |
| 149 | |
| 150 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().settings.use_basic_moderust-analyzer cargo bottom 0.14.9 app/AppConfigFields#use_basic_mode. { |
| 151 | self.time_series_datarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#time_series_data. |
| 152 | .addrust-analyzer cargo bottom 0.14.9 app/data/time_series/impl#[TimeSeriesData]add().(&data, used_widgets, settings, filters); |
| 153 | } |
| 154 | |
| 155 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(mut network) = data.networkrust-analyzer cargo bottom 0.14.9 collection/Data#network. { |
| 156 | if settings.network_start_zeroedrust-analyzer cargo bottom 0.14.9 app/AppConfigFields#network_start_zeroed. { |
| 157 | let TotalNetworkDatarust-analyzer cargo bottom 0.14.9 app/data/store/TotalNetworkData# { |
| 158 | total_rxrust-analyzer cargo bottom 0.14.9 app/data/store/TotalNetworkData#total_rx.: starting_total_rx, |
| 159 | total_txrust-analyzer cargo bottom 0.14.9 app/data/store/TotalNetworkData#total_tx.: starting_total_tx, |
| 160 | } = self.starting_total_networkrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#starting_total_network..get_or_insertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]get_or_insert().(TotalNetworkDatarust-analyzer cargo bottom 0.14.9 app/data/store/TotalNetworkData# { |
| 161 | total_rxrust-analyzer cargo bottom 0.14.9 app/data/store/TotalNetworkData#total_rx.: network.total_rxrust-analyzer cargo bottom 0.14.9 collection/network/NetworkHarvest#total_rx., |
| 162 | total_txrust-analyzer cargo bottom 0.14.9 app/data/store/TotalNetworkData#total_tx.: network.total_txrust-analyzer cargo bottom 0.14.9 collection/network/NetworkHarvest#total_tx., |
| 163 | }); |
| 164 | |
| 165 | network.total_rxrust-analyzer cargo bottom 0.14.9 collection/network/NetworkHarvest#total_rx. = network.total_rxrust-analyzer cargo bottom 0.14.9 collection/network/NetworkHarvest#total_rx..saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]saturating_sub().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().starting_total_rx); |
| 166 | network.total_txrust-analyzer cargo bottom 0.14.9 collection/network/NetworkHarvest#total_tx. = network.total_txrust-analyzer cargo bottom 0.14.9 collection/network/NetworkHarvest#total_tx..saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]saturating_sub().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().starting_total_tx); |
| 167 | } |
| 168 | self.network_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#network_harvest. = network; |
| 169 | } |
| 170 | |
| 171 | self.ram_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#ram_harvest. = data.memoryrust-analyzer cargo bottom 0.14.9 collection/Data#memory.; |
| 172 | self.swap_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#swap_harvest. = data.swaprust-analyzer cargo bottom 0.14.9 collection/Data#swap.; |
| 173 | |
| 174 | #[cfg(not(target_os = "windows"))] |
| 175 | { |
| 176 | self.cache_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#cache_harvest. = data.cacherust-analyzer cargo bottom 0.14.9 collection/Data#cache.; |
| 177 | } |
| 178 | |
| 179 | #[cfg(feature = "zfs")] |
| 180 | { |
| 181 | self.arc_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#arc_harvest. = data.arcrust-analyzer cargo bottom 0.14.9 collection/Data#arc.; |
| 182 | } |
| 183 | |
| 184 | #[cfg(feature = "gpu")] |
| 185 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(gpu) = data.gpurust-analyzer cargo bottom 0.14.9 collection/Data#gpu. { |
| 186 | self.gpu_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#gpu_harvest. = gpu; |
| 187 | } |
| 188 | |
| 189 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(cpu) = data.cpurust-analyzer cargo bottom 0.14.9 collection/Data#cpu. { |
| 190 | self.cpu_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#cpu_harvest. = cpu; |
| 191 | } |
| 192 | |
| 193 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(load_avg) = data.load_avgrust-analyzer cargo bottom 0.14.9 collection/Data#load_avg. { |
| 194 | self.load_avg_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#load_avg_harvest. = load_avg; |
| 195 | } |
| 196 | |
| 197 | self.temp_datarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#temp_data. = data |
| 198 | .temperature_sensorsrust-analyzer cargo bottom 0.14.9 collection/Data#temperature_sensors. |
| 199 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|sensors| { |
| 200 | sensors |
| 201 | .into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().() |
| 202 | .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|temp| Filterrust-analyzer cargo bottom 0.14.9 app/filter/Filter#::optional_should_keeprust-analyzer cargo bottom 0.14.9 app/filter/impl#[Filter]optional_should_keep().(&filters.temp_filterrust-analyzer cargo bottom 0.14.9 app/DataFilters#temp_filter., &temp.namerust-analyzer cargo bottom 0.14.9 collection/temperature/TempSensorData#name.)) |
| 203 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|temp| TempWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/temperature_table/TempWidgetData# { |
| 204 | sensorrust-analyzer cargo bottom 0.14.9 widgets/temperature_table/TempWidgetData#sensor.: temp.namerust-analyzer cargo bottom 0.14.9 collection/temperature/TempSensorData#name., |
| 205 | temperaturerust-analyzer cargo bottom 0.14.9 widgets/temperature_table/TempWidgetData#temperature.: temp |
| 206 | .temperaturerust-analyzer cargo bottom 0.14.9 collection/temperature/TempSensorData#temperature. |
| 207 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|c| settings.temperature_typerust-analyzer cargo bottom 0.14.9 app/AppConfigFields#temperature_type..convert_temp_unitrust-analyzer cargo bottom 0.14.9 app/data/temperature/impl#[TemperatureType]convert_temp_unit().(c)), |
| 208 | }) |
| 209 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().() |
| 210 | }) |
| 211 | .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().(); |
| 212 | |
| 213 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(disks) = data.disksrust-analyzer cargo bottom 0.14.9 collection/Data#disks. |
| 214 | && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(io) = data.iorust-analyzer cargo bottom 0.14.9 collection/Data#io. |
| 215 | { |
| 216 | self.eat_disksrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[InnerData]eat_disks().(disks, io, harvested_time); |
| 217 | |
| 218 | if used_widgets.use_disk_io_graphrust-analyzer cargo bottom 0.14.9 app/layout_manager/UsedWidgets#use_disk_io_graph. { |
| 219 | self.time_series_datarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#time_series_data..update_disk_iorust-analyzer cargo bottom 0.14.9 app/data/time_series/impl#[TimeSeriesData]update_disk_io().( |
| 220 | &self.disk_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#disk_harvest., |
| 221 | &filters.disk_io_graph_filterrust-analyzer cargo bottom 0.14.9 app/DataFilters#disk_io_graph_filter., |
| 222 | settings.disk_io_graph_show_unmountedrust-analyzer cargo bottom 0.14.9 app/AppConfigFields#disk_io_graph_show_unmounted., |
| 223 | ); |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(list_of_processes) = data.list_of_processesrust-analyzer cargo bottom 0.14.9 collection/Data#list_of_processes. { |
| 228 | self.process_datarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#process_data..ingestrust-analyzer cargo bottom 0.14.9 app/data/process/impl#[ProcessData]ingest().(list_of_processes); |
| 229 | } |
| 230 | |
| 231 | #[cfg(feature = "battery")] |
| 232 | { |
| 233 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(list_of_batteries) = data.list_of_batteriesrust-analyzer cargo bottom 0.14.9 collection/Data#list_of_batteries. { |
| 234 | self.battery_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#battery_harvest. = list_of_batteries; |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | // And we're done eating. Update time and push the new entry! |
| 239 | self.last_update_timerust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#last_update_time. = harvested_time; |
| 240 | } |
| 241 | |
| 242 | fn eat_disksrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[InnerData]eat_disks().(&mut self, disks: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<DiskHarvestrust-analyzer cargo bottom 0.14.9 collection/disks/DiskHarvest#>, io: IoHarvestrust-analyzer cargo bottom 0.14.9 collection/disks/IoHarvest#, harvested_time: Instantrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/Instant#) { |
| 243 | let time_since_last_harvest = harvested_time |
| 244 | .duration_sincerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[Instant]duration_since().(self.last_update_timerust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#last_update_time.) |
| 245 | .as_secs_f64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]as_secs_f64().(); |
| 246 | |
| 247 | self.disk_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#disk_harvest..clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]clear().(); |
| 248 | |
| 249 | for disk in disks { |
| 250 | let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(checked_name) = ({ |
| 251 | #[cfg(target_os = "windows")] |
| 252 | { |
| 253 | match &disk.volume_name { |
| 254 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(volume_name) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(volume_name.as_str()), |
| 255 | None => disk.name.split('/').next_back(), |
| 256 | } |
| 257 | } |
| 258 | #[cfg(not(target_os = "windows"))] |
| 259 | { |
| 260 | #[cfg(any(feature = "zfs", target_os = "freebsd"))] |
| 261 | { |
| 262 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().disk.namerust-analyzer cargo bottom 0.14.9 collection/disks/DiskHarvest#name..starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('/') { |
| 263 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(disk.namerust-analyzer cargo bottom 0.14.9 collection/disks/DiskHarvest#name..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()) // use the whole name |
| 264 | } else { |
| 265 | #[cfg(target_os = "freebsd")] |
| 266 | { |
| 267 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(disk.mount_point.as_str()) // use mount_point for sysinfo |
| 268 | } |
| 269 | #[cfg(not(target_os = "freebsd"))] |
| 270 | { |
| 271 | disk.namerust-analyzer cargo bottom 0.14.9 collection/disks/DiskHarvest#name..splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().('/').next_backrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Split<'a, P>`][DoubleEndedIterator]next_back().() // use device name |
| 272 | } |
| 273 | } |
| 274 | } |
| 275 | #[cfg(not(any(feature = "zfs", target_os = "freebsd")))] |
| 276 | { |
| 277 | disk.name.split('/').next_back() |
| 278 | } |
| 279 | } |
| 280 | }) else { |
| 281 | continue; |
| 282 | }; |
| 283 | |
| 284 | let io_device = { |
| 285 | #[cfg(target_os = "macos")] |
| 286 | { |
| 287 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::OnceLockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/once_lock/OnceLock#; |
| 288 | |
| 289 | use regexrust-analyzer cargo regex 1.13.1 crate/::Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#; |
| 290 | |
| 291 | // Must trim one level further for macOS! |
| 292 | static DISK_REGEX: OnceLock<Regex> = OnceLock::new(); |
| 293 | |
| 294 | #[expect( |
| 295 | clippy::regex_creation_in_loops, |
| 296 | reason = "this is fine since it's done via a static OnceLock. In the future though, separate it out." |
| 297 | )] |
| 298 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(new_name) = DISK_REGEX |
| 299 | .get_or_init(|| Regex::new(r"disk\d+").expect("valid regex")) |
| 300 | .find(checked_name) |
| 301 | { |
| 302 | io.get(new_name.as_str()) |
| 303 | } else { |
| 304 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 305 | } |
| 306 | } |
| 307 | #[cfg(not(target_os = "macos"))] |
| 308 | { |
| 309 | io.getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(checked_name) |
| 310 | } |
| 311 | }; |
| 312 | |
| 313 | let (mut io_read_rate_bytes, mut io_write_rate_bytes) = (Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 314 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(io_device)) = io_device { |
| 315 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(prev_io) = self |
| 316 | .prev_iorust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#prev_io. |
| 317 | .get_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get_mut().(&(disk.mount_pointrust-analyzer cargo bottom 0.14.9 collection/disks/DiskHarvest#mount_point..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().(), checked_name) as &dyn PairKeyrust-analyzer cargo bottom 0.14.9 app/data/store/PairKey#) |
| 318 | { |
| 319 | io_read_rate_bytes = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#( |
| 320 | ((io_device.read_bytesrust-analyzer cargo bottom 0.14.9 collection/disks/IoData#read_bytes..saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]saturating_sub().(prev_io.0)) as f64 |
| 321 | /rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div().time_since_last_harvest) |
| 322 | .roundrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]round().() as u64, |
| 323 | ); |
| 324 | |
| 325 | io_write_rate_bytes = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#( |
| 326 | ((io_device.write_bytesrust-analyzer cargo bottom 0.14.9 collection/disks/IoData#write_bytes..saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]saturating_sub().(prev_io.1)) as f64 |
| 327 | /rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div().time_since_last_harvest) |
| 328 | .roundrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]round().() as u64, |
| 329 | ); |
| 330 | |
| 331 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().prev_io = (io_device.read_bytesrust-analyzer cargo bottom 0.14.9 collection/disks/IoData#read_bytes., io_device.write_bytesrust-analyzer cargo bottom 0.14.9 collection/disks/IoData#write_bytes.); |
| 332 | } else { |
| 333 | // Skip on first run. |
| 334 | io_read_rate_bytes = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(0); |
| 335 | io_write_rate_bytes = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(0); |
| 336 | |
| 337 | // TODO: We probably want to also add some cleanup after a while if unused. |
| 338 | self.prev_iorust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#prev_io..insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().( |
| 339 | (disk.mount_pointrust-analyzer cargo bottom 0.14.9 collection/disks/DiskHarvest#mount_point..clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().(), checked_name.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 340 | (io_device.read_bytesrust-analyzer cargo bottom 0.14.9 collection/disks/IoData#read_bytes., io_device.write_bytesrust-analyzer cargo bottom 0.14.9 collection/disks/IoData#write_bytes.), |
| 341 | ); |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | let summed_total_bytes = match (disk.used_spacerust-analyzer cargo bottom 0.14.9 collection/disks/DiskHarvest#used_space., disk.free_spacerust-analyzer cargo bottom 0.14.9 collection/disks/DiskHarvest#free_space.) { |
| 346 | (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(used), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(free)) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(used rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Add<Self>`]add().free), |
| 347 | _ => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 348 | }; |
| 349 | |
| 350 | self.disk_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#disk_harvest..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(DiskWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/disk_table/DiskWidgetData# { |
| 351 | namerust-analyzer cargo bottom 0.14.9 widgets/disk_table/DiskWidgetData#name.: disk.namerust-analyzer cargo bottom 0.14.9 collection/disks/DiskHarvest#name., |
| 352 | mount_pointrust-analyzer cargo bottom 0.14.9 widgets/disk_table/DiskWidgetData#mount_point.: disk.mount_pointrust-analyzer cargo bottom 0.14.9 collection/disks/DiskHarvest#mount_point., |
| 353 | free_bytesrust-analyzer cargo bottom 0.14.9 widgets/disk_table/DiskWidgetData#free_bytes.: disk.free_spacerust-analyzer cargo bottom 0.14.9 collection/disks/DiskHarvest#free_space., |
| 354 | used_bytesrust-analyzer cargo bottom 0.14.9 widgets/disk_table/DiskWidgetData#used_bytes.: disk.used_spacerust-analyzer cargo bottom 0.14.9 collection/disks/DiskHarvest#used_space., |
| 355 | total_bytesrust-analyzer cargo bottom 0.14.9 widgets/disk_table/DiskWidgetData#total_bytes.: disk.total_spacerust-analyzer cargo bottom 0.14.9 collection/disks/DiskHarvest#total_space., |
| 356 | summed_total_bytesrust-analyzer cargo bottom 0.14.9 widgets/disk_table/DiskWidgetData#summed_total_bytes., |
| 357 | io_read_rate_bytesrust-analyzer cargo bottom 0.14.9 widgets/disk_table/DiskWidgetData#io_read_rate_bytes., |
| 358 | io_write_rate_bytesrust-analyzer cargo bottom 0.14.9 widgets/disk_table/DiskWidgetData#io_write_rate_bytes., |
| 359 | }); |
| 360 | } |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | /// If we freeze data collection updates, we want to return a "frozen" copy |
| 365 | /// of the data at the time, while still updating things in the background. |
| 366 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 367 | pub enum FrozenStaterust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState# { |
| 368 | #[defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/default:] |
| 369 | NotFrozenrust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState#NotFrozen#, |
| 370 | Frozenrust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState#Frozen#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<InnerDatarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#>), |
| 371 | } |
| 372 | |
| 373 | /// What data to share to other parts of the application. |
| 374 | pub struct DataStorerust-analyzer cargo bottom 0.14.9 app/data/store/DataStore# { |
| 375 | frozen_staterust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#frozen_state.: FrozenStaterust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState#, |
| 376 | innerrust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#inner.: InnerDatarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#, |
| 377 | used_widgetsrust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#used_widgets.: UsedWidgetsrust-analyzer cargo bottom 0.14.9 app/layout_manager/UsedWidgets#, |
| 378 | filtersrust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#filters.: DataFiltersrust-analyzer cargo bottom 0.14.9 app/DataFilters#, |
| 379 | } |
| 380 | |
| 381 | impl DataStorerust-analyzer cargo bottom 0.14.9 app/data/store/DataStore# { |
| 382 | /// Create a new [`DataStore`] |
| 383 | pub fn newrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[DataStore]new().(used_widgets: UsedWidgetsrust-analyzer cargo bottom 0.14.9 app/layout_manager/UsedWidgets#) -> Selfrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[DataStore] { |
| 384 | Selfrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[DataStore] { |
| 385 | frozen_staterust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#frozen_state.: FrozenStaterust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState#::defaultrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[FrozenState][Default]default().(), |
| 386 | innerrust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#inner.: InnerDatarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#::defaultrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[InnerData][Default]default().(), |
| 387 | used_widgetsrust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#used_widgets., |
| 388 | filtersrust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#filters.: DataFiltersrust-analyzer cargo bottom 0.14.9 app/DataFilters#::defaultrust-analyzer cargo bottom 0.14.9 app/impl#[DataFilters][Default]default().(), |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | /// Toggle whether the [`DataState`] is frozen or not. |
| 393 | pub fn toggle_frozenrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[DataStore]toggle_frozen().(&mut self) { |
| 394 | match &self.frozen_staterust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#frozen_state. { |
| 395 | FrozenStaterust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState#::NotFrozenrust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState#NotFrozen# => { |
| 396 | self.frozen_staterust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#frozen_state. = FrozenStaterust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState#::Frozenrust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState#Frozen#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(self.innerrust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#inner..clonerust-analyzer cargo bottom 0.14.9 app/data/store/impl#[InnerData][Clone]clone().())); |
| 397 | } |
| 398 | FrozenStaterust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState#::Frozenrust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState#Frozen#(_) => self.frozen_staterust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#frozen_state. = FrozenStaterust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState#::NotFrozenrust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState#NotFrozen#, |
| 399 | } |
| 400 | } |
| 401 | |
| 402 | /// Return whether the [`DataState`] is frozen or not. |
| 403 | pub fn is_frozenrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[DataStore]is_frozen().(&self) -> bool { |
| 404 | matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(self.frozen_staterust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#frozen_state., FrozenStaterust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState#::Frozenrust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState#Frozen#(_)) |
| 405 | } |
| 406 | |
| 407 | /// Return a reference to the currently available data. Note that if the |
| 408 | /// data is in a frozen state, it will return the snapshot of data from |
| 409 | /// when it was frozen. |
| 410 | pub fn get_datarust-analyzer cargo bottom 0.14.9 app/data/store/impl#[DataStore]get_data().(&self) -> &InnerDatarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData# { |
| 411 | match &self.frozen_staterust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#frozen_state. { |
| 412 | FrozenStaterust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState#::NotFrozenrust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState#NotFrozen# => &self.innerrust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#inner., |
| 413 | FrozenStaterust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState#::Frozenrust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState#Frozen#(collected_data) => collected_data, |
| 414 | } |
| 415 | } |
| 416 | |
| 417 | pub fn set_filtersrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[DataStore]set_filters().(&mut self, filters: DataFiltersrust-analyzer cargo bottom 0.14.9 app/DataFilters#) { |
| 418 | self.filtersrust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#filters. = filters; |
| 419 | } |
| 420 | |
| 421 | /// Eat data. |
| 422 | pub fn eat_datarust-analyzer cargo bottom 0.14.9 app/data/store/impl#[DataStore]eat_data().(&mut self, data: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<Datarust-analyzer cargo bottom 0.14.9 collection/Data#>, settings: &AppConfigFieldsrust-analyzer cargo bottom 0.14.9 app/AppConfigFields#) { |
| 423 | self.innerrust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#inner. |
| 424 | .eat_datarust-analyzer cargo bottom 0.14.9 app/data/store/impl#[InnerData]eat_data().(data, settings, &self.used_widgetsrust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#used_widgets., &self.filtersrust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#filters.); |
| 425 | } |
| 426 | |
| 427 | /// Clean data. |
| 428 | pub fn clean_datarust-analyzer cargo bottom 0.14.9 app/data/store/impl#[DataStore]clean_data().(&mut self, max_duration: Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#) { |
| 429 | self.innerrust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#inner..time_series_datarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#time_series_data..prunerust-analyzer cargo bottom 0.14.9 app/data/time_series/impl#[TimeSeriesData]prune().(max_duration); |
| 430 | } |
| 431 | |
| 432 | /// Reset data state. |
| 433 | pub fn resetrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[DataStore]reset().(&mut self) { |
| 434 | self.frozen_staterust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#frozen_state. = FrozenStaterust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState#::NotFrozenrust-analyzer cargo bottom 0.14.9 app/data/store/FrozenState#NotFrozen#; |
| 435 | self.innerrust-analyzer cargo bottom 0.14.9 app/data/store/DataStore#inner. = InnerDatarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#::defaultrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[InnerData][Default]default().(); |
| 436 | } |
| 437 | } |