pub struct FsClient<F> { /* private fields */ }Expand description
Cloneable owner of one synchronous backend connection.
Implementations§
Source§impl<F> FsClient<F>
impl<F> FsClient<F>
pub fn new(filesystem: F) -> Self
pub fn into_inner(self) -> Result<F, Self>
Source§impl<F: FileSystem> FsClient<F>
impl<F: FileSystem> FsClient<F>
pub fn open_with(&self, request: OpenRequest) -> VfResult<FsFile<F>>
pub fn open_options(&self) -> OpenOptions<'_, F>
pub fn create(&self, path: impl AsRef<Path>) -> VfResult<FsFile<F>>
pub fn read(&self, path: impl AsRef<Path>) -> VfResult<Vec<u8>>
Sourcepub fn read_with_limit(
&self,
path: impl AsRef<Path>,
max_bytes: usize,
) -> VfResult<Vec<u8>>
pub fn read_with_limit( &self, path: impl AsRef<Path>, max_bytes: usize, ) -> VfResult<Vec<u8>>
Read one complete file while limiting the returned allocation.
Use FsFile::read_native or std::io::Read to stream files that
should not be held in one allocation.
pub fn read_to_string(&self, path: impl AsRef<Path>) -> VfResult<String>
Sourcepub fn read_to_string_with_limit(
&self,
path: impl AsRef<Path>,
max_bytes: usize,
) -> VfResult<String>
pub fn read_to_string_with_limit( &self, path: impl AsRef<Path>, max_bytes: usize, ) -> VfResult<String>
Read one complete UTF-8 file with a caller-selected allocation limit.
pub fn write(&self, path: impl AsRef<Path>, data: &[u8]) -> VfResult<()>
Source§impl<F: MetadataFileSystem> FsClient<F>
impl<F: MetadataFileSystem> FsClient<F>
Source§impl<F: DirectoryFileSystem> FsClient<F>
impl<F: DirectoryFileSystem> FsClient<F>
pub fn create_dir(&self, path: impl AsRef<Path>) -> VfResult<()>
pub fn create_dir_with_mode( &self, path: impl AsRef<Path>, mode: u32, ) -> VfResult<()>
pub fn read_dir(&self, path: impl AsRef<Path>) -> VfResult<Vec<DirEntry>>
Sourcepub fn read_dir_with_options(
&self,
path: impl AsRef<Path>,
options: ReadDirOptions,
) -> VfResult<Vec<DirEntry>>
pub fn read_dir_with_options( &self, path: impl AsRef<Path>, options: ReadDirOptions, ) -> VfResult<Vec<DirEntry>>
Read one directory with explicit entry and path-storage limits.
Source§impl<F: DirectoryFileSystem + MetadataFileSystem> FsClient<F>
impl<F: DirectoryFileSystem + MetadataFileSystem> FsClient<F>
Source§impl<F: NamespaceFileSystem + MetadataFileSystem> FsClient<F>
impl<F: NamespaceFileSystem + MetadataFileSystem> FsClient<F>
pub fn remove_file(&self, path: impl AsRef<Path>) -> VfResult<()>
pub fn remove_dir(&self, path: impl AsRef<Path>) -> VfResult<()>
pub fn remove_dir_all(&self, path: impl AsRef<Path>) -> VfResult<()>
pub fn rename( &self, from: impl AsRef<Path>, to: impl AsRef<Path>, ) -> VfResult<()>
Source§impl<F: LinkFileSystem> FsClient<F>
impl<F: LinkFileSystem> FsClient<F>
Source§impl<F: CopyFileSystem> FsClient<F>
impl<F: CopyFileSystem> FsClient<F>
Source§impl<F: VectorFileSystem> FsClient<F>
impl<F: VectorFileSystem> FsClient<F>
Sourcepub fn openv(&self, requests: &[OpenRequest]) -> VfResult<Vec<FsFile<F>>>
pub fn openv(&self, requests: &[OpenRequest]) -> VfResult<Vec<FsFile<F>>>
Open an ordered vector of files.
Success returns one RAII handle per request. Failure returns no handles; VFSI does not promise transactional rollback of other filesystem effects such as file creation.
Sourcepub fn closev(&self, files: Vec<FsFile<F>>) -> VfResult<()>
pub fn closev(&self, files: Vec<FsFile<F>>) -> VfResult<()>
Close a group of files through one vector operation.
On failure, each handle remains armed for best-effort cleanup on drop; explicitly closed prefix handles may consequently receive a harmless second close attempt.