Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Actor for async function without result #164

Closed
Thomasdezeeuw opened this issue Feb 21, 2019 · 2 comments
Closed

Implement Actor for async function without result #164

Thomasdezeeuw opened this issue Feb 21, 2019 · 2 comments
Labels
idea An idea, open to discussion. priority:low Low priority issue.

Comments

@Thomasdezeeuw
Copy link
Owner

Currently example 1b has the following actor.

async fn greeter_actor(_: Context<!>) -> Result<(), !> {
    println!("Hello World");
    Ok(())
}

I would like to following to be possible

async fn greeter_actor(_: Context<!>)  { // Returns `()`.
    println!("Hello World");
}

The following implementation doesn't work as it overlaps with our implementation for Future<Output = Result(), E>.

impl<Fut> Actor for Fut
    where Fut: Future<Output = ()>
{
    type Error = !;

    fn try_poll(self: Pin<&mut Self>, waker: &LocalWaker) -> Poll<Result<(), Self::Error>> {
        self.poll(waker).map(Ok)
    }
}

This requires rust-lang/rfcs#1672.

@Thomasdezeeuw Thomasdezeeuw added priority:low Low priority issue. idea An idea, open to discussion. labels Mar 2, 2019
@Thomasdezeeuw
Copy link
Owner Author

Closing this for now, returning a result is fine.

@Thomasdezeeuw
Copy link
Owner Author

This is now implemented in #372.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea An idea, open to discussion. priority:low Low priority issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant