pub struct FileIO { /* private fields */ }Expand description
FileIO implementation, used to manipulate files in underlying storage.
§Note
All path passed to FileIO must be absolute path starting with scheme string used to construct FileIO.
For example, if you construct FileIO with s3a scheme, then all path passed to FileIO must start with s3a://.
Supported storages:
| Storage | Feature Flag | Expected Path Format | Schemes |
|---|---|---|---|
| Local file system | storage-fs | file | file://path/to/file |
| Memory | storage-memory | memory | memory://path/to/file |
| S3 | storage-s3 | s3, s3a | s3://<bucket>/path/to/file |
| GCS | storage-gcs | gs, gcs | gs://<bucket>/path/to/file |
| OSS | storage-oss | oss | oss://<bucket>/path/to/file |
| Azure Datalake | storage-azdls | abfs, abfss, wasb, wasbs | abfs://<filesystem>@<account>.dfs.core.windows.net/path/to/file or wasb://<container>@<account>.blob.core.windows.net/path/to/file |
Implementations§
Source§impl FileIO
impl FileIO
Sourcepub fn into_builder(self) -> FileIOBuilder
pub fn into_builder(self) -> FileIOBuilder
Convert FileIO into FileIOBuilder which used to build this FileIO.
This function is useful when you want serialize and deserialize FileIO across distributed systems.
Sourcepub fn from_path(path: impl AsRef<str>) -> Result<FileIOBuilder>
pub fn from_path(path: impl AsRef<str>) -> Result<FileIOBuilder>
Try to infer file io scheme from path. See FileIO for supported schemes.
- If it’s a valid url, for example
s3://bucket/a, url scheme will be used, and the rest of the url will be ignored. - If it’s not a valid url, will try to detect if it’s a file path.
Otherwise will return parsing error.
Sourcepub async fn remove_dir_all(&self, path: impl AsRef<str>) -> Result<()>
pub async fn remove_dir_all(&self, path: impl AsRef<str>) -> Result<()>
Remove the path and all nested dirs and files recursively.
§Arguments
- path: It should be absolute path starting with scheme string used to construct
FileIO.
§Behavior
- If the path is a file or not exist, this function will be no-op.
- If the path is a empty directory, this function will remove the directory itself.
- If the path is a non-empty directory, this function will remove the directory and all nested files and directories.
Sourcepub fn new_output(&self, path: impl AsRef<str>) -> Result<OutputFile>
pub fn new_output(&self, path: impl AsRef<str>) -> Result<OutputFile>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FileIO
impl !RefUnwindSafe for FileIO
impl Send for FileIO
impl Sync for FileIO
impl Unpin for FileIO
impl !UnwindSafe for FileIO
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Forward to the method defined on the type
Any.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Forward to the method defined on the type
Any.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more