#[non_exhaustive]pub struct HostContextSnapshots {
pub pre: HostContext,
pub post: HostContext,
}Expand description
Paired pre-run / post-run HostContext snapshots captured
from a single test run, intended for sidecar persistence so
downstream analysis can diff the drift-prone dynamic fields
(sched_tunables, hugepages_*, thp_*) between the two
endpoints.
The struct deliberately carries both snapshots in full —
including the static fields (uname triple, CPU identity, total
memory) that are OnceLock-cached and therefore guaranteed equal
across a single process. Duplicating them on the wire (a few
hundred bytes of JSON per sidecar) keeps each snapshot
self-describing so a consumer that only cares about the
post-run state can read
HostContextSnapshots::post in isolation without reassembling
fields from HostContextSnapshots::pre, and a consumer that
diffs the pair does not have to special-case “which field is
cached and which is dynamic”.
Serde shape: both fields serialize as a full HostContext
object under their own keys. The per-field
#[serde(default, skip_serializing_if = ...)] policy on
HostContext carries through, so populated snapshots stay
compact. The whole struct is #[non_exhaustive] — see
[crate::non_exhaustive] for construction and pattern-match
rules.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.pre: HostContextCaptured before the test body runs — typically via
collect_host_context_pre_run at the start of sidecar
setup.
post: HostContextCaptured after the test body finishes — typically via
collect_host_context at sidecar-write time.
Implementations§
Source§impl HostContextSnapshots
impl HostContextSnapshots
Sourcepub fn new(pre: HostContext, post: HostContext) -> Self
pub fn new(pre: HostContext, post: HostContext) -> Self
Construct a pair from explicit pre/post snapshots. Prefer
this constructor over a (forbidden cross-crate) struct
literal so future fields can land on
HostContextSnapshots without breaking callers.
Trait Implementations§
Source§impl Clone for HostContextSnapshots
impl Clone for HostContextSnapshots
Source§fn clone(&self) -> HostContextSnapshots
fn clone(&self) -> HostContextSnapshots
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HostContextSnapshots
impl Debug for HostContextSnapshots
Source§impl<'de> Deserialize<'de> for HostContextSnapshots
impl<'de> Deserialize<'de> for HostContextSnapshots
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for HostContextSnapshots
impl PartialEq for HostContextSnapshots
Source§impl Serialize for HostContextSnapshots
impl Serialize for HostContextSnapshots
impl Eq for HostContextSnapshots
impl StructuralPartialEq for HostContextSnapshots
Auto Trait Implementations§
impl Freeze for HostContextSnapshots
impl RefUnwindSafe for HostContextSnapshots
impl Send for HostContextSnapshots
impl Sync for HostContextSnapshots
impl Unpin for HostContextSnapshots
impl UnwindSafe for HostContextSnapshots
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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