pub struct TestTempDir { /* private fields */ }Expand description
A uniquely named temporary directory backed by [TempDirGuard].
The directory name includes the process ID, a process-local counter, and the current timestamp so parallel test binaries and repeated runs do not share filesystem state. The utils-layer guard owns recursive cleanup, including early-return and panic paths.
Implementations§
Source§impl TestTempDir
impl TestTempDir
Sourcepub fn new(scope: &str) -> Self
pub fn new(scope: &str) -> Self
Creates an isolated directory under the platform temporary directory.
§Panics
Panics when scope is invalid, the system clock predates the Unix epoch, or the directory
cannot be created.
Sourcepub fn new_in(root: impl AsRef<Path>, scope: &str) -> Self
pub fn new_in(root: impl AsRef<Path>, scope: &str) -> Self
Creates an isolated directory below root.
This is useful when a test intentionally needs a path below the package directory, such as configuration tests that verify runtime-relative path rendering.
§Panics
Panics when scope is invalid, the system clock predates the Unix epoch, or the directory
cannot be created below root.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TestTempDir
impl RefUnwindSafe for TestTempDir
impl Send for TestTempDir
impl Sync for TestTempDir
impl Unpin for TestTempDir
impl UnwindSafe for TestTempDir
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].