sdk: readable clients (no Empty wrapper, no unused error module), documented examples with tests

This commit is contained in:
2026-10-23 01:05:19 +01:00
parent edc2d1a63b
commit 0516158883
15 changed files with 426 additions and 81 deletions
+17
View File
@@ -11,6 +11,23 @@ impl Consumer {
.on_notify(|name, _| eprintln!("typed progress: {name}"))
.await? as i32)
}
/// Connect to a world endpoint from the real core.
async fn world_endpoint(&self) -> Result<u64> {
let control = probe::control::connect("/state/control").await?;
let received = std::rc::Rc::new(std::cell::Cell::new(false));
let progress = received.clone();
let result = control
.stats()
.on_notify(move |name, value| {
progress.set(name == "endpoint-progress" && value["value"] == 7);
})
.await?;
assert!(
received.get(),
"the endpoint must deliver progress before its result"
);
Ok(result)
}
/// Connect to the provider's endpoint and receive its notification.
async fn endpoint(&self) -> Result<u64> {
let control = probe::control::connect("/endpoint").await?;