serialize sbot stat struct

This commit is contained in:
glyph 2022-01-26 11:45:25 +02:00
parent 51eff6a298
commit de9b8f5d73
1 changed files with 12 additions and 4 deletions

View File

@ -2,19 +2,27 @@
use std::{process::Command, str};
#[cfg(feature = "miniserde_support")]
use miniserde::{Deserialize, Serialize};
#[cfg(feature = "serde_support")]
use serde::{Deserialize, Serialize};
use crate::StatsError;
/// go-sbot process statistics.
#[derive(Debug)]
#[cfg_attr(feature = "miniserde_support", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
pub struct SbotStat {
/// Current process state.
state: String,
pub state: String,
/// Current process memory usage in bytes.
memory: Option<u32>,
pub memory: Option<u32>,
/// Uptime for the process (if state is `active`).
uptime: Option<String>,
pub uptime: Option<String>,
/// Downtime for the process (if state is `inactive`).
downtime: Option<String>,
pub downtime: Option<String>,
}
impl SbotStat {