Struct tempfile::NamedTempFileOptions [] [src]

pub struct NamedTempFileOptions<'a, 'b> { /* fields omitted */ }

Create a new temporary file with custom parameters.

Example

use tempfile::NamedTempFileOptions;

let named_temp_file = NamedTempFileOptions::new()
                        .prefix("hogehoge")
                        .suffix(".rs")
                        .rand_bytes(5)
                        .create()
                        .unwrap();
let name = named_temp_file.path()
  .file_name().unwrap()
  .to_str().unwrap();

assert!(name.starts_with("hogehoge"));
assert!(name.ends_with(".rs"));
assert_eq!(name.len(), "hogehoge.rs".len() + 5);

Methods

impl<'a, 'b> NamedTempFileOptions<'a, 'b>
[src]

[src]

Create a new NamedTempFileOptions

[src]

Set a custom filename prefix.

Path separators are legal but not advisable. Default: ".tmp"

[src]

Set a custom filename suffix.

Path separators are legal but not advisable. Default: ""

[src]

Set the number of random bytes.

Default: 6

[src]

Create the named temporary file.

[src]

Create the named temporary file in the specified directory.

Trait Implementations

impl<'a, 'b> Debug for NamedTempFileOptions<'a, 'b>
[src]

[src]

Formats the value using the given formatter.

impl<'a, 'b> Clone for NamedTempFileOptions<'a, 'b>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<'a, 'b> Eq for NamedTempFileOptions<'a, 'b>
[src]

impl<'a, 'b> PartialEq for NamedTempFileOptions<'a, 'b>
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.