rustup: sweeping fixes for all the changes in 1.0-alpha

- Some switches to u64 instead of usize
- For now, allow(unstable)
- use associated types for all the Network stuff
This commit is contained in:
Sean McArthur
2015-01-10 00:46:43 -08:00
parent 4026ec1d73
commit f7124bb8e2
24 changed files with 232 additions and 362 deletions

View File

@@ -34,7 +34,7 @@ impl HeaderFormat for CacheControl {
}
/// CacheControl contains a list of these directives.
#[derive(PartialEq, Clone)]
#[derive(PartialEq, Clone, Show)]
pub enum CacheDirective {
/// "no-cache"
NoCache,
@@ -47,11 +47,11 @@ pub enum CacheDirective {
// request directives
/// "max-age=delta"
MaxAge(usize),
MaxAge(u32),
/// "max-stale=delta"
MaxStale(usize),
MaxStale(u32),
/// "min-fresh=delta"
MinFresh(usize),
MinFresh(u32),
// response directives
/// "must-revalidate"
@@ -63,7 +63,7 @@ pub enum CacheDirective {
/// "proxy-revalidate"
ProxyRevalidate,
/// "s-maxage=delta"
SMaxAge(usize),
SMaxAge(u32),
/// Extension directives. Optionally include an argument.
Extension(String, Option<String>)
@@ -95,11 +95,6 @@ impl fmt::String for CacheDirective {
}
}
impl fmt::Show for CacheDirective {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
self.to_string().fmt(fmt)
}
}
impl FromStr for CacheDirective {
fn from_str(s: &str) -> Option<CacheDirective> {
use self::CacheDirective::*;

View File

@@ -7,9 +7,9 @@ use header::shared::util::from_one_raw_str;
///
/// Simply a wrapper around a `usize`.
#[derive(Copy, Clone, PartialEq, Show)]
pub struct ContentLength(pub usize);
pub struct ContentLength(pub u64);
deref!(ContentLength => usize);
deref!(ContentLength => u64);
impl Header for ContentLength {
fn header_name(_: Option<ContentLength>) -> &'static str {
@@ -23,17 +23,7 @@ impl Header for ContentLength {
impl HeaderFormat for ContentLength {
fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let ContentLength(ref value) = *self;
write!(fmt, "{}", value)
}
}
impl ContentLength {
/// Returns the wrapped length.
#[deprecated = "use Deref instead"]
#[inline]
pub fn len(&self) -> usize {
**self
fmt::String::fmt(&self.0, fmt)
}
}

View File

@@ -16,10 +16,6 @@ use cookie::CookieJar;
#[derive(Clone, PartialEq, Show)]
pub struct Cookies(pub Vec<Cookie>);
//TODO: remove when fixed in libstd
unsafe impl Send for Cookies {}
unsafe impl Sync for Cookies {}
deref!(Cookies => Vec<Cookie>);
impl Header for Cookies {

View File

@@ -13,10 +13,6 @@ use cookie::CookieJar;
#[derive(Clone, PartialEq, Show)]
pub struct SetCookie(pub Vec<Cookie>);
//TODO: remove when fixed in libstd
unsafe impl Send for SetCookie {}
unsafe impl Sync for SetCookie {}
deref!(SetCookie => Vec<Cookie>);
impl Header for SetCookie {

View File

@@ -1,6 +1,7 @@
use header::{Header, HeaderFormat, CaseInsensitive};
use header::{Header, HeaderFormat};
use std::fmt::{self};
use header::shared::util::{from_comma_delimited, fmt_comma_delimited, from_one_raw_str};
use unicase::UniCase;
/// The `Allow` header.
/// See also https://tools.ietf.org/html/rfc7231#section-7.1.4
@@ -10,7 +11,7 @@ pub enum Vary {
/// This corresponds to '*'.
Any,
/// The header field names which will influence the response representation.
Headers(Vec<CaseInsensitive>),
Headers(Vec<UniCase<String>>),
}
impl Header for Vary {