#[repr(C)]pub struct PdHostVtable {
pub pd_send: Option<unsafe extern "C" fn(ctx: *mut PdActorContext, envelope_bytes: *const u8, payload: *const u8, payload_len: u32) -> i32>,
pub pd_now_micros: Option<unsafe extern "C" fn(ctx: *mut PdActorContext) -> u64>,
pub pd_log: Option<unsafe extern "C" fn(ctx: *mut PdActorContext, level: i32, msg: *const u8, msg_len: u32)>,
}Expand description
Engine capabilities made available to plugin actors during lifecycle calls.
The engine allocates and fills this struct before invoking any actor
lifecycle function. Plugin code accesses it via PdActorContext::vtable.
All function pointers are guaranteed non-null during lifecycle calls.
Fields§
§pd_send: Option<unsafe extern "C" fn(ctx: *mut PdActorContext, envelope_bytes: *const u8, payload: *const u8, payload_len: u32) -> i32>Send a message to another actor.
envelope_bytes must point to exactly ENVELOPE_SIZE (80) bytes
in PdEnvelope layout. payload points to payload_len bytes.
Returns 0 on success; a negative PdError code on failure.
pd_now_micros: Option<unsafe extern "C" fn(ctx: *mut PdActorContext) -> u64>Return the current engine time in microseconds since an arbitrary epoch.
In production, this is wall-clock time. In simulation (pd-test),
this returns the deterministic virtual clock value.
pd_log: Option<unsafe extern "C" fn(ctx: *mut PdActorContext, level: i32, msg: *const u8, msg_len: u32)>Emit a structured log message.
level: 0 = error, 1 = warn, 2 = info, 3 = debug, 4 = trace.
msg points to msg_len UTF-8 bytes — not null-terminated.