pub struct FileEntry {
pub uri: FileUri,
pub name: String,
pub metadata: FileMetadata,
}Expand description
One listed filesystem entry with URI-derived display name and metadata.
The public fields can be changed independently, so consumers must not assume
name still matches uri after arbitrary construction or mutation.
§Examples
use ailloli_ui_fs::{FileEntry, FileKind, FileMetadata, FileUri};
let entry = FileEntry::new(FileUri::parse("file:///tmp/main%20file.rs")?, FileMetadata::new(FileKind::File));
assert_eq!(entry.name, "main%20file.rs");Fields§
§uri: FileUriStable provider URI for the entry.
name: StringProvider/display name; Self::new uses the final encoded URI segment.
metadata: FileMetadataMetadata snapshot associated with the listing.
Implementations§
Source§impl FileEntry
impl FileEntry
Sourcepub fn new(uri: FileUri, metadata: FileMetadata) -> Self
pub fn new(uri: FileUri, metadata: FileMetadata) -> Self
Creates an entry whose name is the URI’s last non-empty encoded segment.
A root URI has no file name and therefore produces an empty name. Percent
escapes are not decoded; use FileUri::file_name_decoded when needed.
§Examples
use ailloli_ui_fs::{FileEntry, FileKind, FileMetadata, FileUri};
let root = FileEntry::new(FileUri::parse("file:///")?, FileMetadata::new(FileKind::Directory));
assert!(root.name.is_empty());Trait Implementations§
Source§impl<'de> Deserialize<'de> for FileEntry
impl<'de> Deserialize<'de> for FileEntry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for FileEntry
impl StructuralPartialEq for FileEntry
Auto Trait Implementations§
impl Freeze for FileEntry
impl RefUnwindSafe for FileEntry
impl Send for FileEntry
impl Sync for FileEntry
impl Unpin for FileEntry
impl UnwindSafe for FileEntry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more