update tests

This commit is contained in:
Evan Almloff committed 2023-05-31 13:57:33 -05:00
1 parent 58b74c1155
commit 35befa1784
12 files changed
+334 -236

No files matched your search

+16
View File
@@ -29,6 +29,22 @@ pub enum NavigationTarget<R: Routable> {
External(String),
}
impl<R: Routable> From<&str> for NavigationTarget<R>
where
<R as FromStr>::Err: Display,
{
fn from(value: &str) -> Self {
Self::from_str(value).unwrap_or_else(|err| match err {
NavigationTargetParseError::InvalidUrl(e) => {
panic!("Failed to parse `{}` as a URL: {}", value, e)
}
NavigationTargetParseError::InvalidInternalURL(e) => {
panic!("Failed to parse `{}` as a `Routable`: {}", value, e)
}
})
}
}
impl<R: Routable> From<R> for NavigationTarget<R> {
fn from(value: R) -> Self {
Self::Internal(value)