#[non_exhaustive]pub struct FileInfo {Show 13 fields
pub name: String,
pub end_of_file: u64,
pub allocation_size: u64,
pub creation_time: u64,
pub last_access_time: u64,
pub last_write_time: u64,
pub change_time: u64,
pub is_directory: bool,
pub read_only: bool,
pub file_index: u64,
pub unix_mode: Option<u32>,
pub ea_size: u32,
pub file_attributes: u32,
}Expand description
Filesystem-style metadata for a single file or directory. Built with
FileInfo::new; every field is public.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringDisplay name (last component). For QUERY_INFO at the share root this is the share name.
end_of_file: u64File size in bytes. The server reports a directory with a size of 0 whatever this says.
allocation_size: u64Allocation size, usually end_of_file rounded up to a cluster.
Backends may return end_of_file. The server reports 0 for a
directory.
creation_time: u64FILETIME (100ns ticks since 1601).
last_access_time: u64§last_write_time: u64§change_time: u64§is_directory: boolTrue if this is a directory.
read_only: boolThe file has FILE_ATTRIBUTE_READONLY.
file_index: u64Stable id of the file, unique within the share including any mounts
below the share root, reported as the file id by QUERY_INFO and
QUERY_DIRECTORY. Backends return the same value from Handle::stat
and Handle::list_dir for the same file, across opens and renames.
0 if the backend has none; the server then tells files apart by
path, so a file reached through two hard links counts as two files:
share modes, byte-range locks and leases taken through one name do
not see opens through the other, and clients on the two names can
both cache writes to it.
unix_mode: Option<u32>POSIX mode of the file, file type bits included, as st_mode has
it. Directory listings give macOS clients that negotiated Apple’s
extensions its low 16 bits. None where the host has no modes.
ea_size: u32Bytes the file’s extended attributes take as FILE_FULL_EA_INFORMATION
entries of what Handle::eas returns, each 8 bytes, the name, a
NUL and the value, padded to 4 bytes. 0 when it has none or the
backend does not report BackendCapabilities::extended_attributes.
FileEaInformation, FileAllInformation and directory listings report
it as EaSize; on an open of a named stream, the file’s.
file_attributes: u32The file’s other attributes (MS-FSCC 2.6) as the backend stores
them: any of FILE_ATTRIBUTE_HIDDEN, SYSTEM, ARCHIVE,
TEMPORARY, OFFLINE and NOT_CONTENT_INDEXED. Other flags here
are ignored: read_only and is_directory give READONLY and
DIRECTORY. 0 for a backend that stores none of them.
Implementations§
Source§impl FileInfo
impl FileInfo
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
A zero-length, writable file named name with no times and no file
id. Set the fields the backend knows.
Sourcepub fn attributes(&self) -> u32
pub fn attributes(&self) -> u32
SMB2 file attributes (MS-FSCC 2.6) for this file:
FILE_ATTRIBUTE_DIRECTORY for directories,
FILE_ATTRIBUTE_READONLY for read-only files, and the flags of
FileInfo::file_attributes. FILE_ATTRIBUTE_NORMAL stands alone
when none applies.