Struct lrs::file::File

An opened file in a filesystem.

Syntax

struct File {
    /* private fields */
}

Static methods

NameDescription
current_dir

Creates a file that points to the current working directory.

invalid

Creates a file on which every operation fails.

memory

Creates a memory-backed file.

open

Opens a file with custom flags.

open_read

Opens a file in read-only mode.

Methods

ReceiverNameDescription
&selfadd_seals

Adds seals to this file.

&selfadvise

Advises the kernel that a range in the file will have a certain usage pattern.

&selfchange_mode

Changes the mode of this file.

&selfchange_owner

Changes the owner of this file.

&mut selfclose

Closes the file.

&selfcollapse

Removes a range from the file and closes the gap.

&selfcreate_hole

Creates a hole in the file.

&selfdata_sync

Flushes enough data and mate-data to the disk that the content of the file can be read again.

&selfduplicate

Creates a new file referring to the same file description.

&selffilename

Returns the path of the file that was used to open this file.

&selffilename_buf

Returns the path of the file that was used to open this file.

&selffs_info

Returns information about the filesystem in which this file in stored.

&selfgather_write

Writes from multiple buffers to the file.

&selfgather_write_at

Writes from multiple buffers to an offset in the file.

&selfget_attr

Gets an attribute of this file.

&selfget_attr_buf

Gets an attribute of this file.

&selfget_status_flags

Retrieves the file status flags and access mode.

&selfinfo

Retrieves information about the file.

&selflink

Creates a hard link to the file.

&selflink_rel_to

Creates a hard link to this file relative to a directory.

&selflist_attr

Returns an iterator over the attributes in this file.

&selflist_attr_buf

Returns an iterator over the attributes in this file.

&selflist_attr_size

Returns the buffer size required in a list_attr_buf call.

&selflock_exclusive

Tries to lock this file exclusively.

&selflock_shared

Tries to lock this file shared.

&selfread

Reads from the file.

&selfread_at

Reads from a position in the file.

&selfreadahead

Initiates readahead of the specified range.

&selfrel_can_access

Returns whether a path relative to this file can be accessed.

&selfrel_change_mode

Change the mode of a file relative to this file.

&selfrel_change_owner

Changes the owner of a file relative to this file.

&selfrel_change_owner_no_follow

Changes the owner of a file relative to this file without following symlinks.

&selfrel_create_device

Creates a device special file relative to this file.

&selfrel_create_dir

Creates a directory relative to this file.

&selfrel_create_file

Creates a file at a path relative to this file.

&selfrel_exchange

Atomically exchanges two files relative to this file.

&selfrel_exists

Returns whether a path relative to this file points to an existing file.

&selfrel_info

Returns information about a path relative to this file.

&selfrel_info_no_follow

Returns information about a path relative to this file without following symlinks.

&selfrel_open

Opens a path relative to this file.

&selfrel_open_read

Opens a path for reading relative to this file.

&selfrel_read_link

Reads the target of a symbolic link relative to this file.

&selfrel_read_link_buf

Reads the target of a symbolic link relative to this file.

&selfrel_real_path

Returns a canonicalized absolute path relative to this file.

&selfrel_real_path_buf

Returns a canonicalized absolute path relative to this file.

&selfrel_remove

Removes a link.

&selfrel_rename

Renames a file relative to this file.

&selfrel_set_times

Changes the access and modification times of a file pointed to by a path relative to this file.

&selfrel_set_times_no_follow

Changes the access and modification times of a file pointed to by a path relative to this file without following symlinks.

&selfrel_symlink

Creates a symlink relative to this file.

&selfremove_attr

Removes an attribute of this file.

&selfreserve

Reserves space for this file in the filesystem.

&selfscatter_read

Reads from the file into multiple buffers.

&selfscatter_read_at

Reads from a position in the file into multiple buffers.

&selfseals

Returns the seals of this file.

&selfseek

Changes the read/write position of the file.

&selfset_attr

Sets an attribute of this file.

&selfset_cwd

Set the current working directory to the directory represented by this file.

&selfset_len

Changes the length of the file.

&selfset_times

Changes the access and modification times of the file.

&selfsync

Flushes all data and meta-data of the file to the disk.

&selfsync_filesystem

Flushes all data and meta-data of the filesystem containing the file to the disk.

&selftry_lock_exclusive

Tries to lock this file exclusively without blocking.

&selftry_lock_shared

Tries to lock this file shared without blocking.

&selfunlock

Unlocks this file.

&selfwrite

Writes to the file.

&selfwrite_at

Writes to an offset in the file.

&selfzero

Zeroes a range in the file.

Trait implementations

NameDescription
Drop

Objects with a destructor.

Eq

Objects that implement the binary == and != operators.

FDContainer

Objects that are file descriptor wrappers.

Read

Objects that wrap a byte-stream for reading.

UndefState

Types that are not valid when they contain certain bit patterns.

Write

Objects that wrap a byte-stream for writing.