Skip to main content

ProcessInfoBuilder

Struct ProcessInfoBuilder 

Source
pub struct ProcessInfoBuilder { /* private fields */ }
Expand description

Builds a ProcessInfo, which is #[non_exhaustive] and so cannot be written as a struct literal outside this crate.

Every setter takes the field’s own type, Option included, rather than the unwrapped value. That is deliberate and it is the difference between a straight port and a rewrite: the daemon already holds Option<u32> for a pid and Option<f32> for a CPU reading, so .pid(entry.pid()) carries across unchanged where .pid(u32) would put an if let ladder at every call site. A setter is skipped, not passed None, when a row genuinely has nothing to say about that field.

Defaults for the skipped fields are the ones a not-yet-running sheep has: no pid, no uptime, no restarts, no resource reading, not a dog, never exited.

Implementations§

Source§

impl ProcessInfoBuilder

Source

pub fn pid(self, pid: Option<u32>) -> Self

Sets the OS pid; None while the sheep is not running.

Source

pub fn restarts(self, restarts: u32) -> Self

Sets the restart count since registration.

Source

pub fn uptime_ms(self, uptime_ms: u64) -> Self

Sets milliseconds since the last successful start.

Source

pub fn fold(self, fold: Option<String>) -> Self

Sets fold membership.

Source

pub fn out_file(self, out_file: Option<String>) -> Self

Sets the resolved stdout log path.

Source

pub fn err_file(self, err_file: Option<String>) -> Self

Sets the resolved stderr log path.

Source

pub fn cpu_percent(self, cpu_percent: Option<f32>) -> Self

Sets tree CPU as a percentage of one core.

Source

pub fn memory_bytes(self, memory_bytes: Option<u64>) -> Self

Sets tree resident set size in bytes.

Source

pub fn dog(self, dog: Option<DogSource>) -> Self

Marks this row a dog and names where the dog came from.

Source

pub fn lambs(self, lambs: Option<Vec<Lamb>>) -> Self

Sets the sheep’s lamb list; None when this reply did not walk for one.

Source

pub fn last_exit(self, last_exit: Option<ExitInfo>) -> Self

Sets how this sheep’s process most recently stopped; None while it has never exited under this daemon.

Source

pub fn smit(self, smit: Option<String>) -> Self

Sets the marker a dog has painted on this sheep; None when none has.

Source

pub fn instance(self, instance: Option<u32>) -> Self

Sets the instance slot; None when the peer daemon predates the field.

Source

pub fn build(self) -> ProcessInfo

Finishes the row.

Trait Implementations§

Source§

impl Clone for ProcessInfoBuilder

Source§

fn clone(&self) -> ProcessInfoBuilder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProcessInfoBuilder

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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.