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]
impl<'a, 'b> NamedTempFileOptions<'a, 'b>pub fn new() -> Self[src]
pub fn new() -> SelfCreate a new NamedTempFileOptions
ⓘImportant traits for &'a mut Rpub fn prefix(&mut self, prefix: &'a str) -> &mut Self[src]
ⓘImportant traits for &'a mut R
pub fn prefix(&mut self, prefix: &'a str) -> &mut SelfSet a custom filename prefix.
Path separators are legal but not advisable. Default: ".tmp"
ⓘImportant traits for &'a mut Rpub fn suffix(&mut self, suffix: &'b str) -> &mut Self[src]
ⓘImportant traits for &'a mut R
pub fn suffix(&mut self, suffix: &'b str) -> &mut SelfSet a custom filename suffix.
Path separators are legal but not advisable. Default: ""
ⓘImportant traits for &'a mut Rpub fn rand_bytes(&mut self, rand: usize) -> &mut Self[src]
ⓘImportant traits for &'a mut R
pub fn rand_bytes(&mut self, rand: usize) -> &mut SelfSet the number of random bytes.
Default: 6
pub fn create(&self) -> Result<NamedTempFile>[src]
pub fn create(&self) -> Result<NamedTempFile>Create the named temporary file.
pub fn create_in<P: AsRef<Path>>(&self, dir: P) -> Result<NamedTempFile>[src]
pub fn create_in<P: AsRef<Path>>(&self, dir: P) -> Result<NamedTempFile>Create the named temporary file in the specified directory.
Trait Implementations
impl<'a, 'b> Debug for NamedTempFileOptions<'a, 'b>[src]
impl<'a, 'b> Debug for NamedTempFileOptions<'a, 'b>fn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl<'a, 'b> Clone for NamedTempFileOptions<'a, 'b>[src]
impl<'a, 'b> Clone for NamedTempFileOptions<'a, 'b>fn clone(&self) -> NamedTempFileOptions<'a, 'b>[src]
fn clone(&self) -> NamedTempFileOptions<'a, 'b>Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)1.0.0
[src]Performs copy-assignment from source. Read more
impl<'a, 'b> Eq for NamedTempFileOptions<'a, 'b>[src]
impl<'a, 'b> Eq for NamedTempFileOptions<'a, 'b>impl<'a, 'b> PartialEq for NamedTempFileOptions<'a, 'b>[src]
impl<'a, 'b> PartialEq for NamedTempFileOptions<'a, 'b>fn eq(&self, other: &NamedTempFileOptions<'a, 'b>) -> bool[src]
fn eq(&self, other: &NamedTempFileOptions<'a, 'b>) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &NamedTempFileOptions<'a, 'b>) -> bool[src]
fn ne(&self, other: &NamedTempFileOptions<'a, 'b>) -> boolThis method tests for !=.
Auto Trait Implementations
impl<'a, 'b> Send for NamedTempFileOptions<'a, 'b>
impl<'a, 'b> Send for NamedTempFileOptions<'a, 'b>impl<'a, 'b> Sync for NamedTempFileOptions<'a, 'b>
impl<'a, 'b> Sync for NamedTempFileOptions<'a, 'b>