State Inspection
Before applying a change, you should understand the current state, and what the change will do.
To discover the current state of all items, Item::try_state_current
is run for each item concurrently.
let graph = /* .. */;
let resources = /* .. */;
let resources = StatesDiscoverCmd::current(graph, resources).await?;
// Item1::StateCurrentFn::try_exec
let exists = param1.path().exists();
Ok(State::new(exists, ()))
// Item2::StateCurrentFn::try_exec
let instance_url = discover(param2).await?;
Ok(State::new(Some(instance_url), ()))
// Item3::StateCurrentFn::try_exec
let version = reqwest::get(instance_url).await?;
Ok(State::new(version, ()))
// ..
When all states have been collected, they are presented to the user:
state1: exists
state2: 1.2.3.4
state3: 1.0.0
state4: abcdef0123456