pub struct TempTracingLocation { /* private fields */ }Expand description
A temporary location for storing traces.
Used for tests that need to verify certain events happened based on the application traces.
Implementations§
Source§impl TempTracingLocation
impl TempTracingLocation
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Creates a new temporary directory for trace files, and generates their UUID7 filename prefix.
§Errors
Returns anyhow::Error if we fail to:
- Create a new temporary directory
- Get the string representation of that directory’s path
Sourcepub fn dir(&self) -> &TempDir
pub fn dir(&self) -> &TempDir
Returns a reference to the temporary directory which will hold the trace files.
Sourcepub fn path(&self) -> &str
pub fn path(&self) -> &str
Returns a string representation of the path, corresponding to Self::dir.
Sourcepub fn file_prefix(&self) -> &str
pub fn file_prefix(&self) -> &str
The trace filename prefix.
Sourcepub fn read_first_trace(&self) -> Result<Option<String>>
pub fn read_first_trace(&self) -> Result<Option<String>>
Iterates over the temporary directory and finds the first trace file that matches the Self::file_prefix.
§Returns
The contents of the found trace file, if any.
§Errors
Returns anyhow::Error if we fail to:
- Read the temporary directory
- Get entries in that directory
- Read the entry matching the given prefix into a string
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TempTracingLocation
impl RefUnwindSafe for TempTracingLocation
impl Send for TempTracingLocation
impl Sync for TempTracingLocation
impl Unpin for TempTracingLocation
impl UnsafeUnpin for TempTracingLocation
impl UnwindSafe for TempTracingLocation
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
Converts
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> ⓘ
Converts
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request