Skip to main content

call

Function call 

Source
pub async fn call<Cmd, T>(
    tx: &Sender<Cmd>,
    build: impl FnOnce(Sender<T>) -> Cmd,
) -> Result<T, Closed>
Expand description

Send one command carrying a fresh oneshot ack, and await the reply.

This is the plumbing every host’s own caller-facing method builds on: build wraps the ack half into that host’s own Cmd variant, call sends it and awaits the reply, and a channel that is closed on either leg — the command couldn’t be enqueued, or the ack was dropped without a reply — collapses to one Closed error. What a caller does with that error (fail open, fail closed, propagate it) stays entirely up to the caller; this helper only ever reports whether the round trip happened.

§Errors

Returns Closed if the dedicated thread has shut down: either the command could not be enqueued, or the ack was dropped without a reply.