#[repr(C)]pub struct FileInfo { /* private fields */ }
Expand description
Generic file information
The following rules apply when using this struct with set_info()
:
- On directories, the file size is determined by the contents of the
directory and cannot be changed by setting
file_size
. This member is ignored byset_info()
. - The
physical_size
is determined by thefile_size
and cannot be changed. This member is ignored byset_info()
. - The
FileAttribute::DIRECTORY
bit cannot be changed. It must match the file’s actual type. - A value of zero in create_time, last_access, or modification_time causes the fields to be ignored (and not updated).
- It is forbidden to change the name of a file to the name of another existing file in the same directory.
- If a file is read-only, the only allowed change is to remove the read-only attribute. Other changes must be carried out in a separate transaction.
Implementations
sourceimpl FileInfo
impl FileInfo
sourcepub fn new<'buf>(
storage: &'buf mut [u8],
file_size: u64,
physical_size: u64,
create_time: Time,
last_access_time: Time,
modification_time: Time,
attribute: FileAttribute,
file_name: &CStr16
) -> Result<&'buf mut Self, FileInfoCreationError>
pub fn new<'buf>(
storage: &'buf mut [u8],
file_size: u64,
physical_size: u64,
create_time: Time,
last_access_time: Time,
modification_time: Time,
attribute: FileAttribute,
file_name: &CStr16
) -> Result<&'buf mut Self, FileInfoCreationError>
Create a FileInfo
structure
The structure will be created in-place within the provided storage
buffer. The buffer must be large enough to hold the data structure,
including a null-terminated UCS-2 name
string.
The buffer must be correctly aligned. You can query the required
alignment using the alignment()
method of the Align
trait that this
struct implements.
sourcepub fn physical_size(&self) -> u64
pub fn physical_size(&self) -> u64
Physical space consumed by the file on the file system volume
sourcepub fn create_time(&self) -> &Time
pub fn create_time(&self) -> &Time
Time when the file was created
sourcepub fn last_access_time(&self) -> &Time
pub fn last_access_time(&self) -> &Time
Time when the file was last accessed
sourcepub fn modification_time(&self) -> &Time
pub fn modification_time(&self) -> &Time
Time when the file’s contents were last modified
sourcepub fn attribute(&self) -> FileAttribute
pub fn attribute(&self) -> FileAttribute
Attribute bits for the file
Trait Implementations
sourceimpl Align for FileInfo
impl Align for FileInfo
sourcefn offset_up_to_alignment(val: usize) -> usize
fn offset_up_to_alignment(val: usize) -> usize
Calculate the offset from val
necessary to make it aligned,
rounding up. For example, if val
is 1 and the alignment is 8,
this will return 7. Returns 0 if val == 0
. Read more
sourcefn round_up_to_alignment(val: usize) -> usize
fn round_up_to_alignment(val: usize) -> usize
Round val
up so that it is aligned.
sourcefn align_buf(buf: &mut [u8]) -> Option<&mut [u8]>
fn align_buf(buf: &mut [u8]) -> Option<&mut [u8]>
Get a subslice of buf
where the address of the first element
is aligned. Returns None
if no element of the buffer is
aligned. Read more
sourcefn assert_aligned(storage: &mut [u8])
fn assert_aligned(storage: &mut [u8])
Assert that some storage is correctly aligned for this type