pub trait BatchMessage:
Serialize
+ for<'de> Deserialize<'de>
+ Send
+ Sync
+ 'static {
// Required method
fn message_type_id() -> u64;
// Provided methods
fn to_json(&self) -> Result<Vec<u8>, Error> { ... }
fn from_json(bytes: &[u8]) -> Result<Self, Error>
where Self: Sized { ... }
fn size_hint(&self) -> usize { ... }
}Expand description
Trait for batch kernel messages (CPU-orchestrated execution).
This trait provides serialization and type information for messages
used with BatchKernel implementations. Unlike RingMessage which
uses rkyv for GPU-native serialization, BatchMessage uses serde
for JSON serialization suitable for CPU-side orchestration.
Typically derived using #[derive(KernelMessage)]:
ⓘ
#[derive(Debug, Clone, Serialize, Deserialize, KernelMessage)]
#[message(type_id = 100, domain = "GraphAnalytics")]
pub struct PageRankInput {
pub graph: CsrGraph,
pub damping: f64,
}Required Methods§
Sourcefn message_type_id() -> u64
fn message_type_id() -> u64
Get the message type ID.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".