Bla.
Last active
March 17, 2016 03:23
-
-
Save dpc/a6bd306b8187651ec700 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
target | |
Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "mioco-break" | |
version = "0.1.0" | |
authors = ["Dawid Ciężarkiewicz <[email protected]>"] | |
[lib] | |
path = "lib.rs" | |
[dependencies] | |
mio = "0.5.*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: | |
cargo build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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