about summary refs log tree commit diff
path: root/src/libstd/io/net/udp.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/io/net/udp.rs')
-rw-r--r--src/libstd/io/net/udp.rs33
1 files changed, 15 insertions, 18 deletions
diff --git a/src/libstd/io/net/udp.rs b/src/libstd/io/net/udp.rs
index b8fb187548c..4dd6f448ee5 100644
--- a/src/libstd/io/net/udp.rs
+++ b/src/libstd/io/net/udp.rs
@@ -35,29 +35,26 @@ use rt::rtio;
 ///
 /// ```rust,no_run
 /// # #![allow(unused_must_use)]
-/// #![feature(slicing_syntax)]
-///
 /// use std::io::net::udp::UdpSocket;
 /// use std::io::net::ip::{Ipv4Addr, SocketAddr};
-/// fn main() {
-///     let addr = SocketAddr { ip: Ipv4Addr(127, 0, 0, 1), port: 34254 };
-///     let mut socket = match UdpSocket::bind(addr) {
-///         Ok(s) => s,
-///         Err(e) => fail!("couldn't bind socket: {}", e),
-///     };
 ///
-///     let mut buf = [0, ..10];
-///     match socket.recv_from(buf) {
-///         Ok((amt, src)) => {
-///             // Send a reply to the socket we received data from
-///             let buf = buf[mut ..amt];
-///             buf.reverse();
-///             socket.send_to(buf, src);
-///         }
-///         Err(e) => println!("couldn't receive a datagram: {}", e)
+/// let addr = SocketAddr { ip: Ipv4Addr(127, 0, 0, 1), port: 34254 };
+/// let mut socket = match UdpSocket::bind(addr) {
+///     Ok(s) => s,
+///     Err(e) => fail!("couldn't bind socket: {}", e),
+/// };
+///
+/// let mut buf = [0, ..10];
+/// match socket.recv_from(buf) {
+///     Ok((amt, src)) => {
+///         // Send a reply to the socket we received data from
+///         let buf = buf[mut ..amt];
+///         buf.reverse();
+///         socket.send_to(buf, src);
 ///     }
-///     drop(socket); // close the socket
+///     Err(e) => println!("couldn't receive a datagram: {}", e)
 /// }
+/// drop(socket); // close the socket
 /// ```
 pub struct UdpSocket {
     obj: Box<RtioUdpSocket + Send>,