use std::ops::Deref; use yazi_shared::url::UrlBuf; pub struct DirEntry(tokio::fs::DirEntry); impl Deref for DirEntry { type Target = tokio::fs::DirEntry; fn deref(&self) -> &Self::Target { &self.0 } } impl From for DirEntry { fn from(value: tokio::fs::DirEntry) -> Self { Self(value) } } impl From for crate::provider::DirEntry { fn from(value: DirEntry) -> Self { crate::provider::DirEntry::Local(value) } } impl DirEntry { #[must_use] pub fn url(&self) -> UrlBuf { self.0.path().into() } } // --- DirEntrySync pub struct DirEntrySync(std::fs::DirEntry); impl Deref for DirEntrySync { type Target = std::fs::DirEntry; fn deref(&self) -> &Self::Target { &self.0 } } impl From for DirEntrySync { fn from(value: std::fs::DirEntry) -> Self { Self(value) } } impl From for crate::provider::DirEntrySync { fn from(value: DirEntrySync) -> Self { crate::provider::DirEntrySync::Local(value) } } impl DirEntrySync { #[must_use] pub fn url(&self) -> UrlBuf { self.0.path().into() } }