Skip to main content

nichlink_run_method/runtime/trace/locals/
local_kind.rs

1//! The role of one local value in a function invocation.
2//! 一个函数调用中局部值的角色。
3
4/// The role of a value in one function invocation.
5/// 一个函数调用中局部值的角色。
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum LocalKind {
8    /// A value passed into the invocation.
9    /// 调用传入的值。
10    Input,
11    /// A value bound inside the invocation body.
12    /// 在调用体内绑定的值。
13    Binding,
14    /// A value the invocation returns.
15    /// 调用返回的值。
16    Output,
17    /// A value handed to a function as one of its parameters.
18    /// 作为某个函数参数被消费的值。
19    Consumer,
20}
21
22impl LocalKind {
23    /// The lowercase token this role prints as in rendered data flow.
24    /// 该角色在渲染数据流中打印的小写标记。
25    pub const fn label(self) -> &'static str {
26        match self {
27            Self::Input => "input",
28            Self::Binding => "let",
29            Self::Output => "return",
30            Self::Consumer => "consumer",
31        }
32    }
33}