Skip to main content

nichlink_run_method/runtime/trace/locals/
observation.rs

1//! Whether a local value came from a live trace or a static inference.
2//! 局部值来自实时追踪还是静态推断。
3
4/// Whether a local value came from a live trace or a static inference.
5/// 局部值来自实时追踪还是静态推断。
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum Observation {
8    /// The value was captured while the traced code ran.
9    /// 被追踪代码运行时捕获到的值。
10    Observed,
11    /// The value is a static inference and was never seen at runtime.
12    /// 由静态推断得出、运行时从未观测到的值。
13    Unobserved,
14}
15
16impl Observation {
17    /// The lowercase token this state prints as in rendered output.
18    /// 该状态在渲染输出中打印的小写标记。
19    pub const fn label(self) -> &'static str {
20        match self {
21            Self::Observed => "observed",
22            Self::Unobserved => "unobserved",
23        }
24    }
25}