pub async fn start_at(
handler: impl Fn(Vec<u8>) -> Pin<Box<dyn Future<Output = HandlerResponse>>> + 'static,
path: impl AsRef<Path> + Send + Sync + 'static,
) -> (bool, UnboundedSender<bool>)
Available on Unix only.
Expand description
Starts an [UnixListener
] at path
with handler
receiving messages.
This starts a new task, and so the future resolves quickly.
The handler
gets the data from the request, and should return whether to close the
listener and the data to send back.
handler
is guaranteed to be inside an async Tokio context - you can use e.g. [tokio::spawn
].
ยงReturn value
Returns true
if we removed an existing socket, false
otherwise.
The removed socket might be live or a leftover from a previous call to this (or any other
UNIX socket creation).
The sender can be used to signal we need to close (if true
is sent)