Conditional keep for TempDir after initialization
Hi!
I was working with some utilities on top of tempfile and I ran into an interesting issue: in some cases (e.g. tests) it's often useful to mark something as conditionally persistent (e.g. if a debugging environment variable is set).
I'm definitely aware of the ability to persist `TempDir`s via `into_path` (as discussed in #315), but that changes the type from `TempDir` to `PathBuf`. That's useful in some cases but gets in the way of others (it's annoying to have to manage your own enum just for this).
Would it be possible to expose a `keep` method, just like there is for `NamedTempFile`? Having such a method would aid this use case tremendously.
Thanks!
关闭于 2025-05-11 6 条评论