Update for latest rust

Tracks rust nightly.

7 tests fail -- still finding source
This commit is contained in:
cyderize
2015-01-10 18:37:10 +11:00
parent 241ebc1270
commit 122e94c8a6
42 changed files with 291 additions and 189 deletions

View File

@@ -9,7 +9,7 @@ pub use self::ConnectionOption::{KeepAlive, Close, ConnectionHeader};
#[derive(Clone, PartialEq, Show)]
pub struct Connection(pub Vec<ConnectionOption>);
deref!(Connection -> Vec<ConnectionOption>);
deref!(Connection => Vec<ConnectionOption>);
/// Values that can be in the `Connection` header.
#[derive(Clone, PartialEq)]
@@ -39,16 +39,22 @@ impl FromStr for ConnectionOption {
}
}
impl fmt::Show for ConnectionOption {
impl fmt::String for ConnectionOption {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
match *self {
write!(fmt, "{}", match *self {
KeepAlive => "keep-alive",
Close => "close",
ConnectionHeader(ref s) => s.as_slice()
}.fmt(fmt)
})
}
}
impl fmt::Show for ConnectionOption {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
self.to_string().fmt(fmt)
}
}
impl Header for Connection {
fn header_name(_: Option<Connection>) -> &'static str {
"Connection"
@@ -62,7 +68,7 @@ impl Header for Connection {
impl HeaderFormat for Connection {
fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let Connection(ref parts) = *self;
fmt_comma_delimited(fmt, parts[])
fmt_comma_delimited(fmt, &parts[])
}
}