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>

source

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.

source

pub fn with_path(thing: T, _path: &'d Path) -> Self

Create from a T and a &Path with the right lifetime

source

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>

source§

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)

Performs copy-assignment from source. Read more
source§

impl<'d, T> Debug for TestTempDirGuard<'d, T>
where T: Debug,

source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'d, T> Deref for TestTempDirGuard<'d, T>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'d, T> DerefMut for TestTempDirGuard<'d, T>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.