forked from nonsensical-dev/zenyx-engine
merged branches
This commit is contained in:
parent
f8316f8ee4
commit
0a494d5ed9
21 changed files with 102 additions and 98 deletions
|
@ -1,4 +1,4 @@
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::{Value, json};
|
use serde_json::{Value, json};
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod modules;
|
mod modules;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#[allow(unused_imports)]
|
||||||
use serde_json;
|
use serde_json;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::modules::{FmtCores, FmtThreads};
|
use crate::modules::{FmtCores, FmtThreads};
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::{Value, json};
|
use serde_json::{Value, json};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use sysinfo::{CpuRefreshKind, RefreshKind, System};
|
use sysinfo::{CpuRefreshKind, RefreshKind, System};
|
||||||
|
@ -49,7 +49,7 @@ pub fn get_struct() -> Result<Vec<CPUInfo>, CPUError> {
|
||||||
String::from("big-endian")
|
String::from("big-endian")
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
entry.threads += 1.into();
|
entry.threads += 1.into();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use super::UNKNOWN;
|
use super::UNKNOWN;
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::{Value, json};
|
use serde_json::{Value, json};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
extern crate hidapi;
|
extern crate hidapi;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::{Value, json};
|
use serde_json::{Value, json};
|
||||||
use std::{cmp::Ordering::Equal, collections::HashMap};
|
use std::{cmp::Ordering::Equal, collections::HashMap};
|
||||||
use sysinfo::{System, Users};
|
use sysinfo::{System, Users};
|
||||||
|
|
|
@ -1,39 +1,42 @@
|
||||||
use serde::{Serialize, Serializer, Deserialize, Deserializer, de::Error as DeError};
|
use derive_more::{Deref, Display, From, Into, with_trait::Display as TDisplay};
|
||||||
use std::{
|
use serde::{Deserialize, Deserializer, Serialize, Serializer, de::Error as DeError};
|
||||||
fmt::{Debug, Display, Formatter, Result as FmtResult},
|
use std::fmt::{Debug, Formatter, Result as FmtResult};
|
||||||
ops::Deref,
|
use strum_macros::{Display as SMDisplay, EnumString, VariantNames};
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Serialize, Deserialize)]
|
#[derive(
|
||||||
|
Copy,
|
||||||
|
Clone,
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
PartialOrd,
|
||||||
|
Ord,
|
||||||
|
Debug,
|
||||||
|
EnumString,
|
||||||
|
SMDisplay,
|
||||||
|
VariantNames,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
)]
|
||||||
|
#[strum(serialize_all = "title_case")]
|
||||||
pub enum TargetPointerWidth {
|
pub enum TargetPointerWidth {
|
||||||
|
#[strum(serialize = "32 Bit")]
|
||||||
W32Bit,
|
W32Bit,
|
||||||
|
#[strum(serialize = "64 Bit")]
|
||||||
W64Bit,
|
W64Bit,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Deref, From, Into, Display)]
|
||||||
|
#[display("{_0}")]
|
||||||
pub struct FmtOSArchitecture(pub TargetPointerWidth);
|
pub struct FmtOSArchitecture(pub TargetPointerWidth);
|
||||||
|
|
||||||
impl FmtOSArchitecture {
|
impl FmtOSArchitecture {
|
||||||
pub const W32_BIT: Self = FmtOSArchitecture(TargetPointerWidth::W32Bit);
|
pub const W32_BIT: Self = Self(TargetPointerWidth::W32Bit);
|
||||||
pub const W64_BIT: Self = FmtOSArchitecture(TargetPointerWidth::W64Bit);
|
pub const W64_BIT: Self = Self(TargetPointerWidth::W64Bit);
|
||||||
}
|
|
||||||
|
|
||||||
impl Display for FmtOSArchitecture {
|
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
|
||||||
write!(
|
|
||||||
f,
|
|
||||||
"{}",
|
|
||||||
match self.0 {
|
|
||||||
TargetPointerWidth::W32Bit => "32 Bit",
|
|
||||||
TargetPointerWidth::W64Bit => "64 Bit",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Debug for FmtOSArchitecture {
|
impl Debug for FmtOSArchitecture {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
||||||
Display::fmt(self, f)
|
TDisplay::fmt(self, f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +45,7 @@ impl Serialize for FmtOSArchitecture {
|
||||||
where
|
where
|
||||||
S: Serializer,
|
S: Serializer,
|
||||||
{
|
{
|
||||||
serializer.serialize_str(&self.to_string())
|
serializer.serialize_str(&self.0.to_string())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,18 +55,8 @@ impl<'de> Deserialize<'de> for FmtOSArchitecture {
|
||||||
D: Deserializer<'de>,
|
D: Deserializer<'de>,
|
||||||
{
|
{
|
||||||
let s = String::deserialize(deserializer)?;
|
let s = String::deserialize(deserializer)?;
|
||||||
match s.as_str() {
|
s.parse::<TargetPointerWidth>()
|
||||||
"32 Bit" => Ok(FmtOSArchitecture(TargetPointerWidth::W32Bit)),
|
.map(FmtOSArchitecture)
|
||||||
"64 Bit" => Ok(FmtOSArchitecture(TargetPointerWidth::W64Bit)),
|
.map_err(|_| DeError::custom(format!("Invalid architecture: {}", s)))
|
||||||
_ => Err(DeError::custom(format!("Invalid architecture: {}", s))),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Deref for FmtOSArchitecture {
|
|
||||||
type Target = TargetPointerWidth;
|
|
||||||
|
|
||||||
fn deref(&self) -> &Self::Target {
|
|
||||||
&self.0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use chrono::{DateTime, Local, TimeZone, Utc};
|
use chrono::{DateTime, Local, TimeZone, Utc};
|
||||||
use serde::{Serialize, Serializer, Deserialize, Deserializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
use std::{
|
use std::{
|
||||||
fmt::{Debug, Display, Formatter, Result as FMTResult},
|
fmt::{Debug, Display, Formatter, Result as FMTResult},
|
||||||
ops::Deref,
|
ops::Deref,
|
||||||
|
@ -65,7 +65,7 @@ where
|
||||||
// 1. Pull a String out of the deserializer
|
// 1. Pull a String out of the deserializer
|
||||||
let s = String::deserialize(deserializer)?;
|
let s = String::deserialize(deserializer)?;
|
||||||
// 2. Parse it, mapping any parse-error into a Serde error
|
// 2. Parse it, mapping any parse-error into a Serde error
|
||||||
<DateTime<Tz> as std::str::FromStr>::from_str(&s) // explicit, no ambiguity
|
<DateTime<Tz> as std::str::FromStr>::from_str(&s) // explicit, no ambiguity
|
||||||
.map(FmtDateTime)
|
.map(FmtDateTime)
|
||||||
.map_err(serde::de::Error::custom)
|
.map_err(serde::de::Error::custom)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
use std::str::FromStr;
|
|
||||||
|
|
||||||
use serde::{Serialize, Deserialize};
|
|
||||||
use detect_desktop_environment::DesktopEnvironment;
|
use detect_desktop_environment::DesktopEnvironment;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::str::FromStr;
|
||||||
use strum_macros::EnumString;
|
use strum_macros::EnumString;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, EnumString)]
|
#[derive(
|
||||||
|
Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, EnumString,
|
||||||
|
)]
|
||||||
#[strum(serialize_all = "PascalCase", ascii_case_insensitive)]
|
#[strum(serialize_all = "PascalCase", ascii_case_insensitive)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub enum FmtDE {
|
pub enum FmtDE {
|
||||||
|
@ -37,8 +38,8 @@ impl FmtDE {
|
||||||
pub fn detect() -> Option<Self> {
|
pub fn detect() -> Option<Self> {
|
||||||
DesktopEnvironment::detect().and_then(|inner_de| {
|
DesktopEnvironment::detect().and_then(|inner_de| {
|
||||||
let s = format!("{:?}", inner_de);
|
let s = format!("{:?}", inner_de);
|
||||||
|
|
||||||
FmtDE::from_str(&s).ok()
|
FmtDE::from_str(&s).ok()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
pub mod architecture;
|
pub mod architecture;
|
||||||
pub mod date_time;
|
pub mod date_time;
|
||||||
pub mod desktop_environment;
|
pub mod desktop_environment;
|
||||||
|
pub mod numbers;
|
||||||
pub mod offset_time;
|
pub mod offset_time;
|
||||||
pub mod relative_time;
|
pub mod relative_time;
|
||||||
pub mod version;
|
pub mod version;
|
||||||
pub mod numbers;
|
|
|
@ -1,7 +1,5 @@
|
||||||
use derive_more::{
|
use derive_more::{Add, AddAssign, Deref, Div, DivAssign, From, Mul, MulAssign, Sub, SubAssign};
|
||||||
Add, AddAssign, Deref, Div, DivAssign, From, Mul, MulAssign, Sub, SubAssign,
|
use serde::{Deserialize, Serialize};
|
||||||
};
|
|
||||||
use serde::{Serialize, Deserialize};
|
|
||||||
use std::fmt::{Debug, Display, Formatter, Result as FmtResult};
|
use std::fmt::{Debug, Display, Formatter, Result as FmtResult};
|
||||||
|
|
||||||
enum DisplayKind {
|
enum DisplayKind {
|
||||||
|
@ -12,10 +10,24 @@ enum DisplayKind {
|
||||||
macro_rules! define_fmt_wrapper {
|
macro_rules! define_fmt_wrapper {
|
||||||
($name:ident, $ty:ty, $display_kind:expr) => {
|
($name:ident, $ty:ty, $display_kind:expr) => {
|
||||||
#[derive(
|
#[derive(
|
||||||
Copy, Clone, PartialEq, Eq, PartialOrd, Ord,
|
Copy,
|
||||||
Add, Sub, Mul, Div,
|
Clone,
|
||||||
AddAssign, SubAssign, MulAssign, DivAssign,
|
PartialEq,
|
||||||
From, Deref, Serialize, Deserialize
|
Eq,
|
||||||
|
PartialOrd,
|
||||||
|
Ord,
|
||||||
|
Add,
|
||||||
|
Sub,
|
||||||
|
Mul,
|
||||||
|
Div,
|
||||||
|
AddAssign,
|
||||||
|
SubAssign,
|
||||||
|
MulAssign,
|
||||||
|
DivAssign,
|
||||||
|
From,
|
||||||
|
Deref,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
)]
|
)]
|
||||||
pub struct $name(pub $ty);
|
pub struct $name(pub $ty);
|
||||||
|
|
||||||
|
@ -32,11 +44,11 @@ macro_rules! define_fmt_wrapper {
|
||||||
DisplayKind::Plural(singular, plural) => {
|
DisplayKind::Plural(singular, plural) => {
|
||||||
let label = if self.0 == 1 { singular } else { plural };
|
let label = if self.0 == 1 { singular } else { plural };
|
||||||
write!(f, "{} {}", self.0, label)
|
write!(f, "{} {}", self.0, label)
|
||||||
},
|
}
|
||||||
DisplayKind::HumanBytes => {
|
DisplayKind::HumanBytes => {
|
||||||
use humansize::{format_size, DECIMAL};
|
use humansize::{DECIMAL, format_size};
|
||||||
write!(f, "{}", format_size(self.0, DECIMAL))
|
write!(f, "{}", format_size(self.0, DECIMAL))
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,4 +63,4 @@ macro_rules! define_fmt_wrapper {
|
||||||
|
|
||||||
define_fmt_wrapper!(FmtThreads, u16, DisplayKind::Plural("Thread", "Threads"));
|
define_fmt_wrapper!(FmtThreads, u16, DisplayKind::Plural("Thread", "Threads"));
|
||||||
define_fmt_wrapper!(FmtCores, usize, DisplayKind::Plural("Core", "Cores"));
|
define_fmt_wrapper!(FmtCores, usize, DisplayKind::Plural("Core", "Cores"));
|
||||||
define_fmt_wrapper!(FmtBytes, u64, DisplayKind::HumanBytes);
|
define_fmt_wrapper!(FmtBytes, u64, DisplayKind::HumanBytes);
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
use chrono::{DateTime, Local, Offset};
|
use chrono::{DateTime, Local, Offset};
|
||||||
use derive_more::{Deref, Display, From};
|
use derive_more::{Deref, Display, From};
|
||||||
use serde::{Serialize, Serializer, Deserialize, Deserializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
use std::{
|
use std::{
|
||||||
cmp::Ordering,
|
cmp::Ordering,
|
||||||
fmt::{Debug, Display, Formatter, Result as FmtResult},
|
fmt::{Debug, Display, Formatter, Result as FmtResult},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Copy, Clone, From, Deref, Display)]
|
#[derive(Copy, Clone, From, Deref, Display)]
|
||||||
#[display("UTC {}", "_0.offset()")]
|
#[display("UTC {}", _0.offset())]
|
||||||
pub struct FmtOffsetTime(pub DateTime<Local>);
|
pub struct FmtOffsetTime(pub DateTime<Local>);
|
||||||
|
|
||||||
impl Debug for FmtOffsetTime {
|
impl Debug for FmtOffsetTime {
|
||||||
|
@ -54,13 +54,21 @@ impl PartialEq for FmtOffsetTime {
|
||||||
impl PartialOrd for FmtOffsetTime {
|
impl PartialOrd for FmtOffsetTime {
|
||||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||||
Some(
|
Some(
|
||||||
self.0.offset().fix().local_minus_utc().cmp(&other.0.offset().fix().local_minus_utc()),
|
self.0
|
||||||
|
.offset()
|
||||||
|
.fix()
|
||||||
|
.local_minus_utc()
|
||||||
|
.cmp(&other.0.offset().fix().local_minus_utc()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Ord for FmtOffsetTime {
|
impl Ord for FmtOffsetTime {
|
||||||
fn cmp(&self, other: &Self) -> Ordering {
|
fn cmp(&self, other: &Self) -> Ordering {
|
||||||
self.0.offset().fix().local_minus_utc().cmp(&other.0.offset().fix().local_minus_utc())
|
self.0
|
||||||
|
.offset()
|
||||||
|
.fix()
|
||||||
|
.local_minus_utc()
|
||||||
|
.cmp(&other.0.offset().fix().local_minus_utc())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,11 @@
|
||||||
use derive_more::{From, Deref, with_trait::Display as Display};
|
use derive_more::{Deref, From, with_trait::Display};
|
||||||
use serde::{Serialize, Serializer, Deserialize, Deserializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
use std::{
|
use std::{
|
||||||
fmt::{Debug, Formatter, Result as FmtResult},
|
fmt::{Debug, Formatter, Result as FmtResult},
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(
|
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, From, Deref)]
|
||||||
Clone,
|
|
||||||
PartialEq,
|
|
||||||
Eq,
|
|
||||||
PartialOrd,
|
|
||||||
Ord,
|
|
||||||
From,
|
|
||||||
Deref,
|
|
||||||
)]
|
|
||||||
pub struct FmtRelativeTime(pub Duration);
|
pub struct FmtRelativeTime(pub Duration);
|
||||||
|
|
||||||
impl Display for FmtRelativeTime {
|
impl Display for FmtRelativeTime {
|
||||||
|
@ -47,4 +39,4 @@ impl<'de> Deserialize<'de> for FmtRelativeTime {
|
||||||
let secs = u64::deserialize(deserializer)?;
|
let secs = u64::deserialize(deserializer)?;
|
||||||
Ok(FmtRelativeTime(Duration::from_secs(secs)))
|
Ok(FmtRelativeTime(Duration::from_secs(secs)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use derive_more::{Display, From, Deref, with_trait::Display as TDisplay};
|
use derive_more::{Deref, Display, From, with_trait::Display as TDisplay};
|
||||||
use serde::{Serialize, Serializer, Deserialize, Deserializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
use std::{
|
use std::{
|
||||||
fmt::{Debug, Formatter, Result as FmtResult},
|
fmt::{Debug, Formatter, Result as FmtResult},
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
|
@ -35,4 +35,4 @@ impl<'de> Deserialize<'de> for FmtVersion {
|
||||||
.map(FmtVersion)
|
.map(FmtVersion)
|
||||||
.map_err(serde::de::Error::custom)
|
.map_err(serde::de::Error::custom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use super::UNKNOWN;
|
use super::UNKNOWN;
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::{Value, json};
|
use serde_json::{Value, json};
|
||||||
use wgpu;
|
use wgpu;
|
||||||
use winit::{
|
use winit::{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::modules::FmtBytes;
|
use crate::modules::FmtBytes;
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::{Value, json};
|
use serde_json::{Value, json};
|
||||||
use sysinfo::System;
|
use sysinfo::System;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::modules::FmtVersion;
|
use crate::modules::FmtVersion;
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::{Value, json};
|
use serde_json::{Value, json};
|
||||||
use sys_locale::get_locale;
|
use sys_locale::get_locale;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
|
@ -13,14 +13,14 @@ pub mod uptime;
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
pub use formatted::{
|
pub use formatted::{
|
||||||
architecture::FmtOSArchitecture,
|
architecture::FmtOSArchitecture,
|
||||||
numbers::FmtBytes,
|
|
||||||
date_time::{FmtDateTime, IntoDateTime},
|
date_time::{FmtDateTime, IntoDateTime},
|
||||||
desktop_environment::FmtDE,
|
desktop_environment::FmtDE,
|
||||||
|
numbers::FmtBytes,
|
||||||
|
numbers::FmtCores,
|
||||||
|
numbers::FmtThreads,
|
||||||
offset_time::FmtOffsetTime,
|
offset_time::FmtOffsetTime,
|
||||||
relative_time::FmtRelativeTime,
|
relative_time::FmtRelativeTime,
|
||||||
version::FmtVersion,
|
version::FmtVersion,
|
||||||
numbers::FmtCores,
|
|
||||||
numbers::FmtThreads,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const UNKNOWN: &str = "Unknown";
|
pub const UNKNOWN: &str = "Unknown";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::{Value, json};
|
use serde_json::{Value, json};
|
||||||
use sysinfo::Networks;
|
use sysinfo::Networks;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use super::UNKNOWN;
|
use super::UNKNOWN;
|
||||||
use crate::modules::{FmtDE, FmtOSArchitecture};
|
use crate::modules::{FmtDE, FmtOSArchitecture};
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::{Value, json};
|
use serde_json::{Value, json};
|
||||||
use sysinfo::System;
|
use sysinfo::System;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::modules::FmtBytes;
|
use crate::modules::FmtBytes;
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::{Value, json};
|
use serde_json::{Value, json};
|
||||||
pub use sysinfo::DiskKind;
|
pub use sysinfo::DiskKind;
|
||||||
use sysinfo::Disks;
|
use sysinfo::Disks;
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
use crate::modules::{FmtDateTime, FmtOffsetTime, FmtRelativeTime};
|
use crate::modules::{FmtDateTime, FmtOffsetTime, FmtRelativeTime};
|
||||||
use chrono::{DateTime, Local, Utc, TimeZone};
|
use chrono::{DateTime, Local, TimeZone, Utc};
|
||||||
use serde::{Serialize, Serializer, Deserialize};
|
use serde::{Deserialize, Serialize, Serializer};
|
||||||
use serde_json::{Value, json};
|
use serde_json::{Value, json};
|
||||||
use std::{
|
use std::{fmt::Display, time::Duration as StdDuration};
|
||||||
time::Duration as StdDuration,
|
|
||||||
fmt::Display,
|
|
||||||
};
|
|
||||||
use sysinfo::System;
|
use sysinfo::System;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
|
@ -57,7 +54,7 @@ pub fn get_struct() -> Result<UptimeInfo, UptimeError> {
|
||||||
local_date_time: FmtDateTime(utc_dt.with_timezone(&Local)),
|
local_date_time: FmtDateTime(utc_dt.with_timezone(&Local)),
|
||||||
utc_date_time: FmtDateTime(utc_dt),
|
utc_date_time: FmtDateTime(utc_dt),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(UptimeInfo {
|
Ok(UptimeInfo {
|
||||||
boot: make_info(boot_time_utc),
|
boot: make_info(boot_time_utc),
|
||||||
now: make_info(Utc::now()),
|
now: make_info(Utc::now()),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue