Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add exists function as a wrapper for std::fs::exists #42

Closed
wants to merge 1 commit into from

Conversation

kanpov
Copy link

@kanpov kanpov commented Dec 17, 2024

Fixes #41

@kanpov
Copy link
Author

kanpov commented Dec 17, 2024

Issue is that std::fs::exists has an MSRV of 1.81 so I'm going to remake the PR with Path::try_exists instead.

@kanpov kanpov closed this Dec 17, 2024
@taiki-e
Copy link
Collaborator

taiki-e commented Dec 17, 2024

std::fs::exists is just a wrapper around std::fs::metadata, so we can do the same.

https://github.com/rust-lang/rust/blob/978c659b72ed7520332a74321dc8accf48b06d94/library/std/src/sys_common/fs.rs#L54-L60

@taiki-e
Copy link
Collaborator

taiki-e commented Dec 18, 2024

Well, Path::try_exists internally uses std::fs::exists, so we can also use it instead of std::fs::metadata-based impl, to implement async_fs::exists.
https://doc.rust-lang.org/1.83.0/src/std/path.rs.html#3035

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add "exists" operation
2 participants