mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
1b7b3376e5
commit
826e26ea5b
2 changed files with 9 additions and 3 deletions
|
|
@ -62,11 +62,17 @@ impl AsUrl for &UrlCow<'_> {
|
||||||
fn as_url(&self) -> Url<'_> { (**self).as_url() }
|
fn as_url(&self) -> Url<'_> { (**self).as_url() }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: AsUrl> From<&'a T> for Url<'a> {
|
impl<'a, T> From<&'a T> for Url<'a>
|
||||||
|
where
|
||||||
|
T: AsUrl + ?Sized,
|
||||||
|
{
|
||||||
fn from(value: &'a T) -> Self { value.as_url() }
|
fn from(value: &'a T) -> Self { value.as_url() }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: AsUrl> From<&'a mut T> for Url<'a> {
|
impl<'a, T> From<&'a mut T> for Url<'a>
|
||||||
|
where
|
||||||
|
T: AsUrl + ?Sized,
|
||||||
|
{
|
||||||
fn from(value: &'a mut T) -> Self { value.as_url() }
|
fn from(value: &'a mut T) -> Self { value.as_url() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ impl Linked {
|
||||||
pub fn from_file(&self, url: Url) -> Vec<PathBuf> {
|
pub fn from_file(&self, url: Url) -> Vec<PathBuf> {
|
||||||
let Some(path) = url.as_path() else { return vec![] };
|
let Some(path) = url.as_path() else { return vec![] };
|
||||||
if let Some((parent, name)) = path.parent().zip(path.file_name()) {
|
if let Some((parent, name)) = path.parent().zip(path.file_name()) {
|
||||||
self.from_dir(&parent).map(|p| p.join(name)).collect()
|
self.from_dir(parent).map(|p| p.join(name)).collect()
|
||||||
} else {
|
} else {
|
||||||
vec![]
|
vec![]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue