Add URL parsing.

This commit is contained in:
Tom Alexander
2023-12-23 20:45:20 -05:00
parent 86d4e25aa0
commit 93e0a2fe98
4 changed files with 77 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
use organic::types::StandardProperties;
use url::Url;
use super::macros::intermediate;
@@ -46,6 +47,7 @@ pub(crate) enum LinkTarget {
impl LinkTarget {
pub(crate) fn from_string<S: AsRef<str>>(input: S) -> Result<LinkTarget, CustomError> {
fn impl_from_string(input: &str) -> Result<LinkTarget, CustomError> {
let parsed = Url::parse(input)?;
Ok(LinkTarget::Raw(input.to_owned()))
}
impl_from_string(input.as_ref())