-
Notifications
You must be signed in to change notification settings - Fork 123
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
use persist() instead of into_path() for temporary directories #42
Comments
My one concern is that we already have a Out of curiosity, what is your use-case for this? I've never added such a function to |
The main usecase it to remove a confusing API ( Usecase: I have to have to store logs/artifacts somewhere but don't care where.
Another possible solution: it is possible that The current docs are:
Maybe this could be changed to:
|
I agree, regardless of what we do the docs can be improved. Mind submitting a PR? |
One possible suggestion, it seems like The only issue is that it is kind of weird to "move" a This would allow |
Persist does more than move tempfiles. It makes them no longer temporary. On windows, this involves changing the file attributes. Also, Now, I could change |
That's a good point. What if |
I'm really not a fan of using options for optional parameters like this.
Except that I'll see it every time I look at the API and kick myself. I hate inconsistent APIs. I'd rather rename |
@Stebalien neither am I maybe we can come up with a better name. Let's sleep on it. |
So, every way I can think of fixing this causes more harm than it helps (breaks a lot of existing code while leaving the API inconsistent). Unless anyone has any bright ideas before the end of the week, I'm planning on cutting a release. |
I think rename it to |
As a solution, yes. I'm just worried that the amount of breakage will dwarf the benefit. |
another solution, |
So, there's the temporary file returned by |
oh I see. And making I'm beginning to like a better documented |
For now, I've just cut a release. I agree that the naming choice here was a bit unfortunate but, it still sort of makes sense and leaving it the way it is minimizes breaking changes. |
I opened this issue at rust-lang-deprecated/tempdir#44 and was requested to open it here instead.
I have copy/pasted the original issue below:
Feature Request
This is a feature/API change request to rename
into_path()
topersist()
, while deprecatinginto_path()
.Reasoning
While I understand the logic behind calling it
into_path()
(since it "converts" the temporary directory into an "ordinary path"),into_path()
actually performs an action from the programmers point of view, namely it removes the invariant that the temporary directory will be deleted ondrop
.This is made even more confusing by the documentation, which says: "This destroys the TempDir without deleting the directory represented by the returned Path." -- from a lingual point of view it sounds like we are destroying the directory
Solution
The text was updated successfully, but these errors were encountered: