async support #1

Open
opened 2017-09-14 07:15:08 +12:00 by mikedilger · 1 comment
mikedilger commented 2017-09-14 07:15:08 +12:00 (Migrated from github.com)

PLAN:

  1. Add a feature "async" and set it in the default features. Depend on futures and tokio_io.

  2. Create a new trait AsyncBufReadExt with the following function

fn stream_until_token<R: AsyncRead, W: AsyncWrite>(stream: &mut R, token: &[u8], out &mut W)
  -> AsyncBufTokenStreamer
{
   ...
}

pub struct AsyncBufTokenStreamer {
   ...
}

impl Future for AsyncBufTokenStreamer {
    type Item = (usize, bool);
    ...
}

The existing code wont change,but the new code will be usable from mime-multipart which needs this to support its own async code.

PLAN: 1) Add a feature "async" and set it in the default features. Depend on futures and tokio_io. 2) Create a new trait AsyncBufReadExt with the following function ```rust fn stream_until_token<R: AsyncRead, W: AsyncWrite>(stream: &mut R, token: &[u8], out &mut W) -> AsyncBufTokenStreamer { ... } pub struct AsyncBufTokenStreamer { ... } impl Future for AsyncBufTokenStreamer { type Item = (usize, bool); ... } ``` The existing code wont change,but the new code will be usable from `mime-multipart` which needs this to support its own async code.
mikedilger commented 2017-09-14 09:10:47 +12:00 (Migrated from github.com)

Pushed my first attempt. 67b588f292

Pushed my first attempt. 67b588f292e98b3ea1c50b53a1cbc6a74c191648
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mikedilger/buf-read-ext#1
No description provided.