Merge pull request #195 from hyperium/rustup

rust upgrade
This commit is contained in:
Sean McArthur
2014-12-12 13:46:30 -08:00
12 changed files with 19 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
use std::fmt::{mod, Show};
use std::str::{FromStr, from_utf8};
use serialize::base64::{ToBase64, FromBase64, Standard, Config};
use serialize::base64::{ToBase64, FromBase64, Standard, Config, Newline};
use header::{Header, HeaderFormat};
/// The `Authorization` header field.
@@ -97,6 +97,7 @@ impl Scheme for Basic {
}
text.as_bytes().to_base64(Config {
char_set: Standard,
newline: Newline::CRLF,
pad: true,
line_length: None
}).fmt(f)

View File

@@ -6,7 +6,7 @@ use super::util::from_one_raw_str;
/// The `Content-Length` header.
///
/// Simply a wrapper around a `uint`.
#[deriving(Clone, PartialEq, Show)]
#[deriving(Copy, Clone, PartialEq, Show)]
pub struct ContentLength(pub uint);
deref!(ContentLength -> uint)

View File

@@ -6,7 +6,7 @@ use super::util::{from_one_raw_str, tm_from_str};
// Egh, replace as soon as something better than time::Tm exists.
/// The `Date` header field.
#[deriving(PartialEq, Clone)]
#[deriving(Copy, PartialEq, Clone)]
pub struct Date(pub Tm);
deref!(Date -> Tm)

View File

@@ -118,7 +118,7 @@ mod tests {
etag = Header::parse_header([b"W/\"\x65\x62\"".to_vec()].as_slice());
assert_eq!(etag, Some(Etag {
weak: true,
tag: "\u0065\u0062".into_string()
tag: "\u{0065}\u{0062}".into_string()
}));
etag = Header::parse_header([b"W/\"\"".to_vec()].as_slice());
@@ -153,4 +153,4 @@ mod tests {
}
}
bench_header!(bench, Etag, { vec![b"W/\"nonemptytag\"".to_vec()] })
bench_header!(bench, Etag, { vec![b"W/\"nonemptytag\"".to_vec()] })

View File

@@ -5,7 +5,7 @@ use header::{Header, HeaderFormat};
use super::util::{from_one_raw_str, tm_from_str};
/// The `Expires` header field.
#[deriving(PartialEq, Clone)]
#[deriving(Copy, PartialEq, Clone)]
pub struct Expires(pub Tm);
deref!(Expires -> Tm)

View File

@@ -5,7 +5,7 @@ use header::{Header, HeaderFormat};
use super::util::{from_one_raw_str, tm_from_str};
/// The `If-Modified-Since` header field.
#[deriving(PartialEq, Clone)]
#[deriving(Copy, PartialEq, Clone)]
pub struct IfModifiedSince(pub Tm);
deref!(IfModifiedSince -> Tm)

View File

@@ -5,7 +5,7 @@ use header::{Header, HeaderFormat};
use super::util::{from_one_raw_str, tm_from_str};
/// The `LastModified` header field.
#[deriving(PartialEq, Clone)]
#[deriving(Copy, PartialEq, Clone)]
pub struct LastModified(pub Tm);
deref!(LastModified -> Tm)

View File

@@ -285,6 +285,8 @@ pub const LINE_ENDING: &'static [u8] = &[CR, LF];
/// A `Show`able struct to easily write line endings to a formatter.
pub struct LineEnding;
impl Copy for LineEnding {}
impl fmt::Show for LineEnding {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.write(LINE_ENDING)

View File

@@ -163,7 +163,7 @@ struct Trace;
impl fmt::Show for Trace {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let _ = backtrace::write(fmt);
::std::result::Ok(())
Result::Ok(())
}
}

View File

@@ -18,9 +18,11 @@ use openssl::ssl::error::{SslError, StreamError, OpenSslErrors, SslSessionClosed
use self::HttpStream::{Http, Https};
/// The write-status indicating headers have not been written.
#[allow(missing_copy_implementations)]
pub struct Fresh;
/// The write-status indicating headers have been written.
#[allow(missing_copy_implementations)]
pub struct Streaming;
/// An abstraction to listen for connections on a certain port.
@@ -236,6 +238,7 @@ impl NetworkStream for HttpStream {
}
/// A connector that will produce HttpStreams.
#[allow(missing_copy_implementations)]
pub struct HttpConnector;
impl NetworkConnector<HttpStream> for HttpConnector {

View File

@@ -1569,6 +1569,8 @@ impl StatusCode {
}
}
impl Copy for StatusCode {}
/// Formats the status code, *including* the canonical reason.
///
/// ```rust
@@ -1684,7 +1686,7 @@ impl ToPrimitive for StatusCode {
/// to get the appropriate *category* of status.
///
/// For HTTP/2.0, the 1xx Informational class is invalid.
#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord)]
#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord, Copy)]
pub enum StatusClass {
/// 1xx: Informational - Request received, continuing process
Informational = 100,

View File

@@ -7,7 +7,7 @@ use std::fmt;
use self::HttpVersion::{Http09, Http10, Http11, Http20};
/// Represents a version of the HTTP spec.
#[deriving(PartialEq, PartialOrd)]
#[deriving(PartialEq, PartialOrd, Copy)]
pub enum HttpVersion {
/// `HTTP/0.9`
Http09,