3 unstable releases

Uses new Rust 2024

0.2.0 Sep 24, 2025
0.1.1 Jul 8, 2025
0.1.0 Jul 8, 2025

#1831 in Asynchronous

Download history 89/week @ 2025-10-05 112/week @ 2025-10-12 197/week @ 2025-10-19 127/week @ 2025-10-26 237/week @ 2025-11-02 260/week @ 2025-11-09 155/week @ 2025-11-16 111/week @ 2025-11-23 71/week @ 2025-11-30 311/week @ 2025-12-07 38/week @ 2025-12-14 82/week @ 2025-12-21 143/week @ 2025-12-28 27/week @ 2026-01-04 103/week @ 2026-01-11 202/week @ 2026-01-18

475 downloads per month

MIT license

8KB

act-zero-ext

Extention macros for act-zero

IntoActorResult Usage

Will wrap a function that returns a Result<T,E> into a function that returns a ActorResult<Result<T, E>>. Also works with Option<T> and returns ActorResult<Option<T>>.

Example:

pub struct App {}

impl App {
    #[act_zero_ext::into_actor_result]
    async fn hello(&self, name: String) -> Result<String, Box<dyn std::error::Error>> {
        Ok(format!("Hello, {}!", name))
    }
}

Will be converted to:

pub struct App {}

impl App {
    pub async fn hello(&self, name: String) -> ActorResult<Result<String, Box<dyn std::error::Error>>> {
        let result = self.do_hello(name).await;
        Produces::Ok(result)
    }

    async fn do_hello(&self, name: String) -> Result<String, Box<dyn std::error::Error>> {
        Ok(format!("Hello, {}!", name))
    }
}

Option Example

pub struct App {}

impl App {
    #[act_zero_ext::into_actor_result]
    async fn find_user(&self, id: u64) -> Option<String> {
        if id > 0 {
            Some(format!("User {}", id))
        } else {
            None
        }
    }
}

Will be converted to:

pub struct App {}

impl App {
    pub async fn find_user(&self, id: u64) -> ActorResult<Option<String>> {
        let result = self.do_find_user(id).await;
        Produces::ok(result)
    }

    async fn do_find_user(&self, id: u64) -> Option<String> {
        if id > 0 {
            Some(format!("User {}", id))
        } else {
            None
        }
    }
}

Dependencies

~0.8–1.5MB
~31K SLoC