Function kernel::registry::erased_user_handshake
source · unsafe fn erased_user_handshake<RD>(
scheduler: &LocalScheduler,
hello_bytes: &[u8],
conn_tx: &ErasedKProducer,
outptr: NonNull<()>,
) -> JoinHandle<Result<(), Error>>where
RD: RegisteredDriver + 'static,
RD::Hello: Serialize + DeserializeOwned,
RD::ConnectError: Serialize + DeserializeOwned,
RD::Request: Serialize + DeserializeOwned,
RD::Response: Serialize + DeserializeOwned,
Expand description
Perform a type-erased userspace handshake, deserializing the
RegisteredDriver::Hello
message from hello_bytes
and returning a
future that writes the handshake result to the provided outptr
, if the
future completes successfully.
§Safety
- This function MUST be called with a
RegisteredDriver
type matching the type used to create theErasedKProducer
. outptr
MUST be a valid pointer to amem::MaybeUninit
<
UserHandshakeResult
<RD>>
, and MUST live as long as the future returned from this function.outptr
is guaranteed to be initialized IF AND ONLY IF the future returned by this method returnsOk
(())
. If this method returns anErr
,outptr
will NOT be initialized.