Struct Config

Source
pub struct Config {
    pub hostname: String,
    pub delay: u64,
    pub server: bool,
    pub client_time_from: String,
    pub client_sort_by: String,
}
Expand description

Config struct holds the user input when running the server. It is a bad design to hold the client’s option as well in the same struct, but as of now, it is here.

Fields§

§hostname: String

hostname of the server. This is derived by this crate from the hostname crate.

§delay: u64

Delay decides how many seconds to sleep after each iteration of scanning /proc

§server: bool

If true, runs as server. Defaults to false. Pass the subcommand server to set it to true.

§client_time_from: String

The time from which the client can fetch data to process.

§client_sort_by: String

Sort the processed data by whatever the user wants.

Implementations§

Source§

impl Config

Returns a new config object. This also gives the following command line argument options.

§Examples

Here are the cli options used to populate the struct.

sudo target/debug/procshot –help

procshot 1.0
nohupped@gmail.com
Snapshots proc periodically. All the options except delay works when 'server' option is not used.

USAGE:
    procshot [FLAGS] [OPTIONS] [SUBCOMMAND]
FLAGS:
    -h, --help       Prints help information
    -o               Sort result by Memory or CPU. Accepted values are...
    -t               Read stats from a specific time. Accepted format: 2015-09-05 23:56:04
    -V, --version    Prints version information

OPTIONS:
    -d, --delay <delay>      Sets delay in seconds before it scans /proc every time. [default: 60]

SUBCOMMANDS:
    help      Prints this message or the help of the given subcommand(s)
    server    Decides whether to run as server or client
Source

pub fn new() -> Self

Trait Implementations§

Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.