Skip to main content

PdHostVtable

Struct PdHostVtable 

Source
#[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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.