async-datagram
Async datagram traits.
Examples
Basic usage
#![feature(futures_api)]
use async_datagram::AsyncDatagram;
struct Udp;
impl AsyncDatagram for Udp {
type Target = std::net::SocketAddr
type Err = io::Error;
fn poll_send_to(
&mut self,
waker: &Waker,
buf: &[u8],
target: Self::Target,
) -> Poll<Result<usize, Self::Err>> {
Poll::Ready(Ok(0))
}
fn poll_recv_from(
&mut self,
waker: &Waker,
buf: &mut [u8],
) -> Poll<Result<(usize, Self::Target), Self::Err>> {
Poll::Pending
}
}
Installation
$ cargo add async-datagram
Safety
This crate uses #![deny(unsafe_code)]
to ensure everything is implemented in
100% Safe Rust.
Contributing
Want to join us? Check out our "Contributing" guide and take a
look at some of these issues:
References
None.
License
MIT OR Apache-2.0