From 16d40e9bfed26c7b11a4f885b85964659ec97c47 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 28 Dec 2015 18:46:36 +0100 Subject: [PATCH] Add util: is_url(String) -> bool --- src/main.rs | 1 + src/util/mod.rs | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 src/util/mod.rs diff --git a/src/main.rs b/src/main.rs index 0d4716a4..19ffa8c7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,6 +23,7 @@ mod runtime; mod module; mod storage; mod ui; +mod util; use module::bm::BM; diff --git a/src/util/mod.rs b/src/util/mod.rs new file mode 100644 index 00000000..6bef3251 --- /dev/null +++ b/src/util/mod.rs @@ -0,0 +1,6 @@ +use url::Url; + +pub fn is_url(url: &String) -> bool { + Url::parse(&url[..]).is_ok() +} +