pub struct File<'a>(/* private fields */);Expand description
File structure.
This structure is used to represent a file in the virtual file system. This is a wrapper around the virtual file system file identifier.
Implementations§
Source§impl<'a> File<'a>
impl<'a> File<'a>
Sourcepub const fn from_synchronous_file(file: SynchronousFile<'a>) -> Self
pub const fn from_synchronous_file(file: SynchronousFile<'a>) -> Self
Wrap an existing file for async I/O, preserving its cursor, flags and authority.
pub fn as_synchronous_file_mut(&mut self) -> &mut SynchronousFile<'a>
Source§impl<'a> File<'a>
impl<'a> File<'a>
pub async fn open( virtual_file_system: &'a VirtualFileSystem, task: TaskIdentifier, path: impl AsRef<Path>, flags: Flags, ) -> Result<Self>
Sourcepub async fn open_with_permissions(
virtual_file_system: &'a VirtualFileSystem,
task: TaskIdentifier,
path: impl AsRef<Path>,
flags: Flags,
permissions: Permissions,
) -> Result<Self>
pub async fn open_with_permissions( virtual_file_system: &'a VirtualFileSystem, task: TaskIdentifier, path: impl AsRef<Path>, flags: Flags, permissions: Permissions, ) -> Result<Self>
Open a file; a file that the call creates gets permissions from its
creation on (see VirtualFileSystem::open_with_permissions).
pub async fn create_unnamed_pipe( file_system: &'a VirtualFileSystem, size: usize, status: StateFlags, ) -> Result<(Self, Self)>
pub async fn set_position(&mut self, position: &Position) -> Result<Size>
pub async fn write(&mut self, buffer: &[u8]) -> Result<usize>
Sourcepub async fn write_at(&mut self, buffer: &[u8], offset: Size) -> Result<usize>
pub async fn write_at(&mut self, buffer: &[u8], offset: Size) -> Result<usize>
Transfer at an explicit offset without changing this opening’s cursor.
Sourcepub async fn write_with_offset(
&mut self,
buffer: &[u8],
offset: Option<Size>,
) -> Result<usize>
pub async fn write_with_offset( &mut self, buffer: &[u8], offset: Option<Size>, ) -> Result<usize>
Transfer using an explicit offset, or the opening’s cursor when absent.
Sourcepub async fn read_slice_from_path(
virtual_file_system: &VirtualFileSystem,
task: TaskIdentifier,
path: impl AsRef<Path>,
buffer: &mut [u8],
) -> Result<()>
pub async fn read_slice_from_path( virtual_file_system: &VirtualFileSystem, task: TaskIdentifier, path: impl AsRef<Path>, buffer: &mut [u8], ) -> Result<()>
Fill the entire slice, returning an I/O error on premature EOF. Close explicitly on success or failure; preserve the I/O error if close also fails.
Sourcepub async fn read_slice_from_character_device(
virtual_file_system: &VirtualFileSystem,
task: TaskIdentifier,
path: impl AsRef<Path>,
buffer: &mut [u8],
) -> Result<()>
pub async fn read_slice_from_character_device( virtual_file_system: &VirtualFileSystem, task: TaskIdentifier, path: impl AsRef<Path>, buffer: &mut [u8], ) -> Result<()>
Fill the entire slice from a mounted character device. A missing device
or an opened handle of another kind returns UnavailableDriver.
pub async fn read_from_path( virtual_file_system: &VirtualFileSystem, task: TaskIdentifier, path: impl AsRef<Path>, buffer: &mut Vec<u8>, ) -> Result<()>
Sourcepub async fn write_to_path(
virtual_file_system: &VirtualFileSystem,
task: TaskIdentifier,
path: impl AsRef<Path>,
buffer: &[u8],
) -> Result<()>
pub async fn write_to_path( virtual_file_system: &VirtualFileSystem, task: TaskIdentifier, path: impl AsRef<Path>, buffer: &[u8], ) -> Result<()>
Write the entire buffer, retrying short writes and rejecting zero progress. Close explicitly on success or failure.
pub async fn write_line(&mut self, buffer: &[u8]) -> Result<usize>
pub async fn display_content<W: Write>( &mut self, w: &mut W, buffer_size: usize, ) -> Result<()>
pub async fn read(&mut self, buffer: &mut [u8]) -> Result<usize>
Sourcepub async fn read_at(
&mut self,
buffer: &mut [u8],
offset: Size,
) -> Result<usize>
pub async fn read_at( &mut self, buffer: &mut [u8], offset: Size, ) -> Result<usize>
Transfer at an explicit offset without changing this opening’s cursor.
Sourcepub async fn read_with_offset(
&mut self,
buffer: &mut [u8],
offset: Option<Size>,
) -> Result<usize>
pub async fn read_with_offset( &mut self, buffer: &mut [u8], offset: Option<Size>, ) -> Result<usize>
Transfer using an explicit offset, or the opening’s cursor when absent.