Trait PathChild

Source
pub trait PathChild {
    // Required method
    fn child<P: AsRef<Utf8Path>>(&self, path: P) -> ChildPath;
}
Expand description

Access paths within a Utf8TempDir for testing.

See ChildPath trait implementations.

use camino_tempfile_ext::prelude::*;

let temp = Utf8TempDir::new().unwrap();
let input_file = temp.child("foo.txt");
input_file.touch().unwrap();
temp.close().unwrap();

Required Methods§

Source

fn child<P: AsRef<Utf8Path>>(&self, path: P) -> ChildPath

Access a path within the temporary directory.

§Examples
use camino_tempfile_ext::prelude::*;

let temp = Utf8TempDir::new().unwrap();
println!("{}", temp.path());
println!("{}", temp.child("foo/bar.txt").as_path());
temp.close().unwrap();

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§