pub trait Entity:
Sized
+ Send
+ Sync
+ 'static {
type Data: Serialize + DeserializeOwned + Clone + Send + Sync + 'static;
const NAME: &'static str;
// Required methods
fn state_view() -> &'static str;
fn list_view() -> &'static str;
}Expand description
Marker trait for HyperStack entities.
This trait is implemented by generated code (via hyperstack sdk create rust)
for each entity type defined in a HyperStack spec.
§Example (Generated Code)
ⓘ
pub struct PumpfunTokenEntity;
impl Entity for PumpfunTokenEntity {
type Data = PumpfunToken;
const NAME: &'static str = "PumpfunToken";
fn state_view() -> &'static str { "PumpfunToken/state" }
fn list_view() -> &'static str { "PumpfunToken/list" }
}§Usage
ⓘ
use hyperstack_sdk::HyperStack;
use my_stack::PumpfunTokenEntity;
let hs = HyperStack::connect("wss://example.com").await?;
let token = hs.get::<PumpfunTokenEntity>("mint_address").await;Required Associated Constants§
Required Associated Types§
Required Methods§
Sourcefn state_view() -> &'static str
fn state_view() -> &'static str
View path for single-entity state subscriptions.
Returns a path like “EntityName/state” for subscribing to a single entity’s complete state by key.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.