pub trait Producer:
Send
+ Sync
+ 'static {
type Item: Send + 'static;
type Snap: Snapshot;
// Required methods
fn snapshot(&self) -> Result<Self::Snap, AttachError>;
fn subscribe(&self) -> Result<Receiver<Self::Item>, AttachError>;
}Expand description
A producer of live data + bootable snapshots. The trait is the only thing engate needs to provide attach semantics; concrete producers (tear pane, WS channel, K8s log stream) implement it.
Required Associated Types§
Required Methods§
Sourcefn snapshot(&self) -> Result<Self::Snap, AttachError>
fn snapshot(&self) -> Result<Self::Snap, AttachError>
Capture the producer’s current state. Must NOT be racy with
subscribe — the contract is “no item between snapshot
capture and live-stream registration may be lost”; concrete
implementors typically subscribe first, then snapshot.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".