Skip to content

Use futures instead of most of this lib #2

@vitiral

Description

@vitiral

I posit that WouldBlock should be an enum which contains the Result. So the type would be:

enum Async<R> {
    Done<R>,  // Done with Result
    WouldBlock,
}

This also removes the funny buisness of using ! as the type of the Other error. If it is an operation that cannot fail, then R is just the Value (as it should be).

Note that this is exactly the same API as the futures Async data type.

pub enum Async<T> {
    Ready(T),
    NotReady,
}

I argue that we should just use futures under the hood for ALL asynchronous core types, and that can easily be converted to the other APIs. This is, in fact, the entire point of futures. I think the nb library serves no purpose then.

The futures api is pretty dang minimal with default-features = false selected. There may be space for us to implement something on top of that minimal interface for use in embedded. That could be the usefulness of this library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions