Skip to main content

NodeAppVTable

Struct NodeAppVTable 

Source
#[repr(C)]
pub struct NodeAppVTable { pub metadata: NodeAppMetadata, pub init: unsafe extern "C" fn(ctx: *const c_void) -> FfiResult, pub shutdown: unsafe extern "C" fn() -> FfiResult, pub handle_request: unsafe extern "C" fn(request_json: *const u8, request_len: usize) -> FfiResult, pub handle_event: unsafe extern "C" fn(event_json: *const u8, event_len: usize) -> FfiResult, pub handle_capability: unsafe extern "C" fn(request_json: *const u8, request_len: usize) -> FfiResult, pub free: unsafe extern "C" fn(ptr: *mut u8, len: usize), }
Expand description

VTable of function pointers for app operations. Returned by the _node_app_entry symbol.

Fields§

§metadata: NodeAppMetadata

App metadata

§init: unsafe extern "C" fn(ctx: *const c_void) -> FfiResult

Initialize the app with the host context. Called once after loading. Returns FfiResult.

§shutdown: unsafe extern "C" fn() -> FfiResult

Shut down the app gracefully. Called before unloading the shared library.

§handle_request: unsafe extern "C" fn(request_json: *const u8, request_len: usize) -> FfiResult

Handle an HTTP request. request_json is a pointer to UTF-8 JSON bytes of length request_len. Returns FfiResult with response JSON in data/data_len.

§handle_event: unsafe extern "C" fn(event_json: *const u8, event_len: usize) -> FfiResult

Handle a domain event. event_json is a pointer to UTF-8 JSON bytes of length event_len. Returns FfiResult (data is typically empty for events).

§handle_capability: unsafe extern "C" fn(request_json: *const u8, request_len: usize) -> FfiResult

Handle a capability invocation from the capability router. request_json is a pointer to UTF-8 JSON bytes (CapabilityRequest) of length request_len. Returns FfiResult with CapabilityResponse JSON in data/data_len. Response is limited to 16MB.

§free: unsafe extern "C" fn(ptr: *mut u8, len: usize)

Free memory allocated by the app (for response data). The host calls this to release FfiResult.data.

Trait Implementations§

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.