Struct test_temp_dir::TestTempDirGuard
source · pub struct TestTempDirGuard<'d, T> { /* private fields */ }
Expand description
A T
which relies on some temporary directory with lifetime d
Obtained from TestTempDir::used_by
.
Using this type means that the T
won’t outlive the temporary directory.
(Typically, if it were to, things would malfunction.
There might even be security hazards!)
Implementations§
source§impl<'d, T> TestTempDirGuard<'d, T>
impl<'d, T> TestTempDirGuard<'d, T>
sourcepub fn into_untracked(self) -> T
pub fn into_untracked(self) -> T
Obtain the inner T
It is up to you to ensure that T
doesn’t outlive
the temp directory used to create it.
sourcepub fn with_path(thing: T, _path: &'d Path) -> Self
pub fn with_path(thing: T, _path: &'d Path) -> Self
Create from a T
and a &Path
with the right lifetime
sourcepub fn new_untracked(thing: T) -> Self
pub fn new_untracked(thing: T) -> Self
Create from a raw T
The returned lifetime is unfounded! It is up to you to ensure that the inferred lifetime is correct!
Trait Implementations§
source§impl<'d, T: Clone> Clone for TestTempDirGuard<'d, T>
impl<'d, T: Clone> Clone for TestTempDirGuard<'d, T>
source§fn clone(&self) -> TestTempDirGuard<'d, T>
fn clone(&self) -> TestTempDirGuard<'d, T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<'d, T> Debug for TestTempDirGuard<'d, T>where
T: Debug,
impl<'d, T> Debug for TestTempDirGuard<'d, T>where
T: Debug,
source§impl<'d, T> Deref for TestTempDirGuard<'d, T>
impl<'d, T> Deref for TestTempDirGuard<'d, T>
source§impl<'d, T> DerefMut for TestTempDirGuard<'d, T>
impl<'d, T> DerefMut for TestTempDirGuard<'d, T>
impl<'d, T: Copy> Copy for TestTempDirGuard<'d, T>
Auto Trait Implementations§
impl<'d, T> Freeze for TestTempDirGuard<'d, T>where
T: Freeze,
impl<'d, T> RefUnwindSafe for TestTempDirGuard<'d, T>where
T: RefUnwindSafe,
impl<'d, T> Send for TestTempDirGuard<'d, T>where
T: Send,
impl<'d, T> Sync for TestTempDirGuard<'d, T>where
T: Sync,
impl<'d, T> Unpin for TestTempDirGuard<'d, T>where
T: Unpin,
impl<'d, T> UnwindSafe for TestTempDirGuard<'d, T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more