pub struct Event<T: ?Sized> {
pub at: SystemTime,
pub value: T,
}
Expand description
Arbitrary event, optionally paired with additional metadata.
Any metadata is added by enabling the correspondent library feature:
timestamps
: adds time of when thisEvent
has happened.
Fields§
§at: SystemTime
Available on crate feature
timestamps
only.SystemTime
when this Event
has happened.
value: T
Actual value of this Event
.
Implementations§
source§impl<T> Event<T>
impl<T> Event<T>
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Unwraps the inner Event::value
loosing all the attached metadata.
sourcepub fn split(self) -> (T, Metadata)
pub fn split(self) -> (T, Metadata)
Splits this Event
to the inner Event::value
and its detached
metadata.
sourcepub fn insert<V>(self, value: V) -> Event<V>
pub fn insert<V>(self, value: V) -> Event<V>
Replaces the inner Event::value
with the given one, dropping the old
one in place.
sourcepub fn map<V>(self, f: impl FnOnce(T) -> V) -> Event<V>
pub fn map<V>(self, f: impl FnOnce(T) -> V) -> Event<V>
Maps the inner Event::value
with the given function.
sourcepub fn replace<V>(self, value: V) -> (T, Event<V>)
pub fn replace<V>(self, value: V) -> (T, Event<V>)
Replaces the inner Event::value
with the given one, returning the
old one along.
Trait Implementations§
impl<T: Copy + ?Sized> Copy for Event<T>
Auto Trait Implementations§
impl<T: ?Sized> RefUnwindSafe for Event<T>where
T: RefUnwindSafe,
impl<T: ?Sized> Send for Event<T>where
T: Send,
impl<T: ?Sized> Sync for Event<T>where
T: Sync,
impl<T: ?Sized> Unpin for Event<T>where
T: Unpin,
impl<T: ?Sized> UnwindSafe for Event<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
source§impl<T> Ext for T
impl<T> Ext for T
source§fn assert_normalized(self) -> AssertNormalized<T>
fn assert_normalized(self) -> AssertNormalized<T>
source§fn normalized<W>(self) -> Normalize<W, T>
fn normalized<W>(self) -> Normalize<W, T>
source§fn summarized(self) -> Summarize<T>
fn summarized(self) -> Summarize<T>
source§fn fail_on_skipped(self) -> FailOnSkipped<T>
fn fail_on_skipped(self) -> FailOnSkipped<T>
source§fn fail_on_skipped_with<F>(self, f: F) -> FailOnSkipped<T, F>
fn fail_on_skipped_with<F>(self, f: F) -> FailOnSkipped<T, F>
source§fn repeat_skipped<W>(self) -> Repeat<W, T>
fn repeat_skipped<W>(self) -> Repeat<W, T>
source§fn repeat_failed<W>(self) -> Repeat<W, T>
fn repeat_failed<W>(self) -> Repeat<W, T>
source§fn repeat_if<W, F>(self, filter: F) -> Repeat<W, T, F>
fn repeat_if<W, F>(self, filter: F) -> Repeat<W, T, F>
Wraps this
Writer
to re-output filter
ed events at the end of an
output.source§fn tee<W, Wr>(self, other: Wr) -> Tee<T, Wr>where
Wr: Writer<W>,
fn tee<W, Wr>(self, other: Wr) -> Tee<T, Wr>where
Wr: Writer<W>,
Attaches the provided
other
Writer
to the current one for passing
events to both of them simultaneously.source§fn discard_arbitrary_writes(self) -> Arbitrary<T>
fn discard_arbitrary_writes(self) -> Arbitrary<T>
Wraps this
Writer
into a discard::Arbitrary
one, providing a
no-op ArbitraryWriter
implementation. Read moresource§fn discard_stats_writes(self) -> Stats<T>
fn discard_stats_writes(self) -> Stats<T>
Wraps this
Writer
into a discard::Stats
one, providing a no-op
StatsWriter
implementation returning only 0
. Read more