Skip to main content

pamoja_transport_from_callbacks

Function pamoja_transport_from_callbacks 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_transport_from_callbacks( callbacks: *const PamojaTransportCallbacks, user_data: *mut c_void, ) -> *mut PamojaTransport
Expand description

Wraps host callbacks in a transport.

§Arguments

  • callbacks - the host’s functions, copied by this call; the struct need not outlive it.
  • user_data - the pointer every callback receives, owned by the host until release is called with it.

§Returns

A handle the caller releases with pamoja_transport_free or hands to a call that consumes it, such as adding it to a ladder. Null if callbacks is null or lacks connect, send, or subscribe; the host then keeps user_data and release is never called.

§Safety

callbacks must point to a valid struct for the duration of the call, and each function in it must honor the contract in the module documentation for as long as the transport, or any transport composed from it, lives.