pub fn ps_tree() -> impl Handler + Reporting
Expand description

Build a handler similar to the ps() built, but as a tree: Its root resource will report the process list as ps does, but there will be additional per-PID resources for the processes below it.

Unlike ps, this is not to be used with .at(), but with .below().

(It can not be used as the root handler or .below(&[]) because of the different ways trailing slashes work in an empty and non-empyt prefix in CoAP and URI resolution; practically, this is rarely a concern and could be addressed with a type parameter if needed. If you still want to use it that way, an easy fix is to change the internal ROOT_NAME to something non-empty like “all”).

Open issues

The output stability caveat of ps() applies.

In this implementation, the individual processes are not shown during resource discovery. To conform with best practices around HATEOS and gradual reveal, the representation of the entry resource should have explicit URI reference pointers to the individual process resources (rather than letting the user guess that they can use the PID number as the final path component).

This should be mitigated either by providing a Link Format representation in addition to the CBOR one, or by using an integrated format like CoRAL.