Expand description


A crate to help synchronizing asynchronous request / responses.


pub async fn main() {
    let handle = aligne::ResponseManager::spawn();
    let remote_a = handle.remote();
    let remote_b = remote_a.clone();

    let _h1 = tokio::spawn(async move {
        let msg = remote_b.request(2).await;
        assert_eq!(msg, "message 2");
        let msg = remote_b.request(1).await;
        assert_eq!(msg, "message 1");

    let _h2 = tokio::spawn(async move {
        remote_a.receive(1, "message 1").await;
        remote_a.receive(2, "message 2").await;



Encapsulates an asynchronous task that receives responses and requests asynchronously and matches them by id (u64). once both the response and the request are received, the request complete its future and receive the response.

Handle to the task of a crate::ResponseManager, can spawn self::ResponseManagerRemote to interact with the task.

Remote to a crate::ResponseManager task. can send responses and await requests that will be matched by ids (u64)