Skip to content

Instantly share code, notes, and snippets.

@dpc dpc/.gitignore
Last active Mar 17, 2016

Embed
What would you like to do?
target
Cargo.lock
[package]
name = "mioco-break"
version = "0.1.0"
authors = ["Dawid Ciężarkiewicz <dpc@dpc.pw>"]
[lib]
path = "lib.rs"
[dependencies]
mio = "0.5.*"
extern crate mio;
use std::io;
mod udp;
pub struct MioAdapter<MT>(MT);
impl<MT> MioAdapter<MT> where MT: mio::Evented + mio::TryRead + 'static
{
/// Try reading data into a buffer.
///
/// This will not block.
pub fn try_read(&mut self, buf: &mut [u8]) -> io::Result<Option<usize>> {
Ok(None)
}
}
all:
cargo build
use super::{MioAdapter};
use std::io;
use std::net::SocketAddr;
use mio;
pub type UdpSocket = MioAdapter<mio::udp::UdpSocket>;
impl UdpSocket {
pub fn try_read(&mut self, buf: &mut [u8]) -> io::Result<Option<(usize, SocketAddr)>> {
Ok(None)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.