Skip to main content

Module view

Module view 

Source
Expand description

View abstractions for unified access to views.

All views return collections (Vec). Use .first() on the result if you need a single item.

§Example

use hyperstack_sdk::prelude::*;
use my_stack::OreRoundViews;

let hs = HyperStack::connect("wss://example.com").await?;

// Access views through the generated views struct
let views = OreRoundViews::new(&hs);

// Get latest round - use .first() for single item
let latest = views.latest().get().await.first().cloned();

// List all rounds
let rounds = views.list().get().await;

// Get specific round by key
let round = views.state().get("round_key").await;

// Watch for updates
let mut stream = views.latest().watch();
while let Some(update) = stream.next().await {
    println!("Latest round updated: {:?}", update);
}

Structs§

StateView
A state view handle that requires a key for access.
ViewBuilder
Builder for creating view handles.
ViewHandle
A handle to a view that provides get/watch operations.
WatchBuilder
Builder for configuring watch subscriptions. Implements Stream directly.

Traits§

Views
Trait for generated view accessor structs.