Closed MaxG87 closed 1 year ago
First, I'd rather not parse templates/patterns.
In terms of with_suffix
, I added support for with_prefix
because it makes debugging much easier and specifying a prefix is very common. On the other hand, if you need this much control over the temporary file name, you're likely better served by using the Builder
explicitly (really, it exists so that we don't have to create a bunch of one-off constructors).
Also see:
That's hardly perfect information, but it appears that prefix is much more common.
This sounds a very reasonable. I will stick with the Builder
then. Thank you very much.
As described in #263 , for a test I write I need to create a temporary file that I pass on to a CLI under test. I need to choose the suffix of the file name.
I couldn't find how to do so using
NamedTempFile
directly. Instead, I had to use theBuilder
, which I found a bit cumbersome. Therefore, I wanted to ask whether it would be possible to add something likeNamedTempFile::with_suffix(...)
or evenNamedTempFile::from_pattern
.The latter,
from_pattern
, would allow to useNamedTempFile
a bit like Unix'mktemp
, which I would find awesome.