Struct asyncio::Coroutine [] [src]

pub struct Coroutine<'a>(_);

Context object that represents the currently executing coroutine.

Methods

impl<'a> Coroutine<'a>
[src]

Provides a Coroutine handler to asynchronous operation.

The CoroutineHandler has trait the Handler, that type of Handler::Output is io::Result<R>.

Examples

use asyncio::{IoObject, IoService, Stream};
use asyncio::ip::{Tcp, TcpSocket};

let io = &IoService::new();
IoService::spawn(io, |coro| {
  let io = coro.io_service();
  let soc = TcpSocket::new(io, Tcp::v4()).unwrap();
  let mut buf = [0; 256];
  let size = soc.async_read_some(&mut buf, coro.wrap()).unwrap();
});

Trait Implementations

impl<'a> IoObject for Coroutine<'a>
[src]

Returns a IoService associated with this object.