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
impl ProcessInfoBuilder
Sourcepub fn pid(self, pid: Option<u32>) -> Self
pub fn pid(self, pid: Option<u32>) -> Self
Sets the OS pid; None while the sheep is not running.
Sourcepub fn uptime_ms(self, uptime_ms: u64) -> Self
pub fn uptime_ms(self, uptime_ms: u64) -> Self
Sets milliseconds since the last successful start.
Sourcepub fn cpu_percent(self, cpu_percent: Option<f32>) -> Self
pub fn cpu_percent(self, cpu_percent: Option<f32>) -> Self
Sets tree CPU as a percentage of one core.
Sourcepub fn memory_bytes(self, memory_bytes: Option<u64>) -> Self
pub fn memory_bytes(self, memory_bytes: Option<u64>) -> Self
Sets tree resident set size in bytes.
Sourcepub fn dog(self, dog: Option<DogSource>) -> Self
pub fn dog(self, dog: Option<DogSource>) -> Self
Marks this row a dog and names where the dog came from.
Sourcepub fn lambs(self, lambs: Option<Vec<Lamb>>) -> Self
pub fn lambs(self, lambs: Option<Vec<Lamb>>) -> Self
Sets the sheep’s lamb list; None when this reply did not walk for one.
Sourcepub fn last_exit(self, last_exit: Option<ExitInfo>) -> Self
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.
Sourcepub fn smit(self, smit: Option<String>) -> Self
pub fn smit(self, smit: Option<String>) -> Self
Sets the marker a dog has painted on this sheep; None when none has.
Sourcepub fn instance(self, instance: Option<u32>) -> Self
pub fn instance(self, instance: Option<u32>) -> Self
Sets the instance slot; None when the peer daemon predates the field.
Sourcepub fn handshook(self, handshook: Option<bool>) -> Self
pub fn handshook(self, handshook: Option<bool>) -> Self
Sets whether this dog has handshaken with the shepherd; None for a
sheep, which has no handshake to report.
Sourcepub fn dog_stale(self, dog_stale: Option<bool>) -> Self
pub fn dog_stale(self, dog_stale: Option<bool>) -> Self
Sets whether the shepherd has given up restarting this dog; None
for a sheep, which is never given up on.
Sourcepub fn build(self) -> ProcessInfo
pub fn build(self) -> ProcessInfo
Finishes the row.
Trait Implementations§
Source§impl Clone for ProcessInfoBuilder
impl Clone for ProcessInfoBuilder
Source§fn clone(&self) -> ProcessInfoBuilder
fn clone(&self) -> ProcessInfoBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more