Skip to main content

hyperstack_sdk/
entity.rs

1/// Stack definition trait - defines the shape of a HyperStack deployment.
2///
3/// ```ignore
4/// use hyperstack_sdk::{Stack, Views};
5///
6/// pub struct OreStack;
7///
8/// impl Stack for OreStack {
9///     type Views = OreRoundViews;
10///
11///     fn name() -> &'static str { "ore-round" }
12///     fn url() -> &'static str { "wss://ore.stack.usehyperstack.com" }
13/// }
14///
15/// // Usage
16/// let hs = HyperStack::<OreStack>::connect().await?;
17/// let rounds = hs.views.latest().get().await;
18/// ```
19pub trait Stack: Sized + Send + Sync + 'static {
20    type Views: crate::view::Views;
21
22    fn name() -> &'static str;
23    fn url() -> &'static str;
24}