From 83d512d20ba6167ea258c417b9054b9ee9c12af2 Mon Sep 17 00:00:00 2001 From: asonix Date: Tue, 10 Mar 2020 10:48:26 -0500 Subject: [PATCH] Add From/Into for url/xsdanyuri --- activitystreams-types/src/primitives/xsd_any_uri.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/activitystreams-types/src/primitives/xsd_any_uri.rs b/activitystreams-types/src/primitives/xsd_any_uri.rs index 72a1e2d..5f1d7ef 100644 --- a/activitystreams-types/src/primitives/xsd_any_uri.rs +++ b/activitystreams-types/src/primitives/xsd_any_uri.rs @@ -5,6 +5,18 @@ pub struct XsdAnyUri(url::Url); #[error("Could not parse XsdAnyUri")] pub struct XsdAnyUriError; +impl From for XsdAnyUri { + fn from(u: url::Url) -> Self { + XsdAnyUri(u) + } +} + +impl From for url::Url { + fn from(u: XsdAnyUri) -> Self { + u.0 + } +} + impl Default for XsdAnyUri { fn default() -> Self { "data:text/plain,uwu".parse().unwrap()