Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed deriving etc. #199

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -7,7 +7,7 @@
// except according to those terms.

use std::cmp;
use std::fmt::{self, Formatter, Write};
use std::fmt::{self, Formatter};
use std::io;
use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs};
use std::vec;
@@ -159,6 +159,7 @@ pub mod quirks;

/// A parsed URL record.
#[derive(Clone)]
#[cfg_attr(feature="serde", derive(Deserialize, Serialize))]
#[cfg_attr(feature="heap_size", derive(HeapSizeOf))]
pub struct Url {
/// Syntax in pseudo-BNF:
@@ -1216,27 +1217,6 @@ impl rustc_serialize::Decodable for Url {
}
}

/// Serializes this URL into a `serde` stream.
///
/// This implementation is only available if the `serde` Cargo feature is enabled.
#[cfg(feature="serde")]
impl serde::Serialize for Url {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: serde::Serializer {
format!("{}", self).serialize(serializer)
}
}

/// Deserializes this URL from a `serde` stream.
///
/// This implementation is only available if the `serde` Cargo feature is enabled.
#[cfg(feature="serde")]
impl serde::Deserialize for Url {
fn deserialize<D>(deserializer: &mut D) -> Result<Url, D::Error> where D: serde::Deserializer {
let string_representation: String = try!(serde::Deserialize::deserialize(deserializer));
Ok(Url::parse(&string_representation).unwrap())
}
}

#[cfg(unix)]
fn path_to_file_url_segments(path: &Path, serialization: &mut String) -> Result<(), ()> {
use std::os::unix::prelude::OsStrExt;
@@ -34,6 +34,7 @@ pub fn url_origin(url: &Url) -> Origin {

/// The origin of an URL
#[derive(PartialEq, Eq, Clone, Debug)]
#[cfg_attr(feature="serde", derive(Deserialize, Serialize))]
#[cfg_attr(feature="heap_size", derive(HeapSizeOf))]
pub enum Origin {
/// A globally unique identifier
@@ -9,7 +9,7 @@
use encoding;
use std::ascii::AsciiExt;
use std::borrow::Cow;
use std::fmt::{self, Write};
use std::fmt;
use std::slice;
use std::str;

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.