tokio-rs / tokio-uring

An io_uring backed runtime for Rust
MIT License
1.11k stars 117 forks source link

create_dir_all and DirBuilder #224

Closed FrankReh closed 1 year ago

FrankReh commented 1 year ago

uring, therefore async, versions of create_dir_all and DirBuilder.

FrankReh commented 1 year ago

For now, this comes with an example binary that was useful in development and testing of the feature. It doesn't make a create example for normal uring use though so I'm happy to consider it temporary and we can remove it as part of this PR or any time later.

Also there is an async version of is_dir that is used solely by this feature which may be useful in its own right one day or at least parts of it as it has to look at libc bits of the statx structure and asking whether a path or a File is a directory is fairly common so there are normally helper functions or methods provided for that. For now our statx call returns a libc::statx structure so the caller is own their own to track down the details of how to do it.

FrankReh commented 1 year ago

FYI. I'm working on a builder version of statx and that will allow getting the statx structure without first having opened the file, so the is_dir function in this create_dir_all can be greatly simplified after that.