std: Convert to rustdoc

This commit is contained in:
Brian Anderson
2012-03-07 18:17:30 -08:00
parent b22556a6f8
commit 95521c4084
26 changed files with 712 additions and 1569 deletions

View File

@@ -1,17 +1,7 @@
/*
Module: net
*/
import vec;
import uint;
/* Section: Types */
/*
Tag: ip_addr
An IP address
*/
#[doc = "An IP address"]
enum ip_addr {
/*
Variant: ipv4
@@ -21,13 +11,7 @@ enum ip_addr {
ipv4(u8, u8, u8, u8),
}
/* Section: Operations */
/*
Function: format_addr
Convert an <ip_addr> to a str
*/
#[doc = "Convert an `ip_addr` to a str"]
fn format_addr(ip: ip_addr) -> str {
alt ip {
ipv4(a, b, c, d) {
@@ -37,17 +21,13 @@ fn format_addr(ip: ip_addr) -> str {
}
}
/*
Function: parse_addr
#[doc = "
Convert a str to `ip_addr`
Convert a str to <ip_addr>
Converts a string of the format `x.x.x.x` into an ip_addr enum.
Converts a string of the format "x.x.x.x" into an ip_addr enum.
Failure:
String must be a valid IPv4 address
*/
Fails if the string is not a valid IPv4 address
"]
fn parse_addr(ip: str) -> ip_addr {
let parts = vec::map(str::split_char(ip, '.'), {|s|
alt uint::from_str(s) {