mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-13 17:25:27 +00:00
compiler: Export to_url from pathutils
The LSP will need this to unify code paths between WASM and binary builds.
This commit is contained in:
parent
ff2bf6849e
commit
77a97ed6b5
1 changed files with 2 additions and 2 deletions
|
|
@ -19,7 +19,7 @@ pub fn is_url(path: &Path) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convert a `Path` to an `url::Url` if possible
|
/// Convert a `Path` to an `url::Url` if possible
|
||||||
fn to_url(path: &str) -> Option<url::Url> {
|
pub fn to_url(path: &str) -> Option<url::Url> {
|
||||||
let Ok(url) = url::Url::parse(path) else {
|
let Ok(url) = url::Url::parse(path) else {
|
||||||
return None;
|
return None;
|
||||||
};
|
};
|
||||||
|
|
@ -35,7 +35,7 @@ fn to_url(path: &str) -> Option<url::Url> {
|
||||||
fn test_to_url() {
|
fn test_to_url() {
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
fn th(input: &str, expected: bool) {
|
fn th(input: &str, expected: bool) {
|
||||||
assert_eq!(to_url(&input).is_some(), expected);
|
assert_eq!(to_url(input).is_some(), expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
th("https://foo.bar/", true);
|
th("https://foo.bar/", true);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue