mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Update to url 2.0
This commit is contained in:
parent
ff3f3d30c7
commit
9392180007
26 changed files with 74 additions and 355 deletions
|
@ -17,6 +17,5 @@ to_shmem = { path = "../to_shmem" }
|
|||
to_shmem_derive = { path = "../to_shmem_derive" }
|
||||
serde = {version = "1.0", features = ["derive"]}
|
||||
servo_rand = {path = "../rand"}
|
||||
url = "1.2"
|
||||
url_serde = {version = "0.2"}
|
||||
url = {version = "2.0", features = ["serde"]}
|
||||
uuid = {version = "0.7", features = ["v4", "serde"]}
|
||||
|
|
|
@ -30,7 +30,7 @@ use url::{Position, Url};
|
|||
|
||||
pub use url::Host;
|
||||
|
||||
#[derive(Clone, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd)]
|
||||
#[derive(Clone, Deserialize, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd, Serialize)]
|
||||
pub struct ServoUrl(#[ignore_malloc_size_of = "Arc"] Arc<Url>);
|
||||
|
||||
impl ToShmem for ServoUrl {
|
||||
|
@ -222,21 +222,3 @@ impl From<Url> for ServoUrl {
|
|||
ServoUrl::from_url(url)
|
||||
}
|
||||
}
|
||||
|
||||
impl serde::Serialize for ServoUrl {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
url_serde::serialize(&*self.0, serializer)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> serde::Deserialize<'de> for ServoUrl {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'de>,
|
||||
{
|
||||
url_serde::deserialize(deserializer).map(Self::from_url)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,15 +14,7 @@ pub enum ImmutableOrigin {
|
|||
Opaque(OpaqueOrigin),
|
||||
|
||||
/// Consists of the URL's scheme, host and port
|
||||
Tuple(
|
||||
String,
|
||||
#[serde(
|
||||
deserialize_with = "url_serde::deserialize",
|
||||
serialize_with = "url_serde::serialize"
|
||||
)]
|
||||
Host,
|
||||
u16,
|
||||
),
|
||||
Tuple(String, Host, u16),
|
||||
}
|
||||
|
||||
impl ImmutableOrigin {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue