2022-06-18 21:56:31 -07:00
|
|
|
use super::*;
|
2019-12-07 03:09:21 -08:00
|
|
|
|
|
|
|
/// A binding of `name` to `value`
|
2021-11-17 00:07:48 -08:00
|
|
|
#[derive(Debug, Clone, PartialEq, Serialize)]
|
2019-12-07 03:09:21 -08:00
|
|
|
pub(crate) struct Binding<'src, V = String> {
|
2024-05-14 18:39:42 -07:00
|
|
|
/// Module depth where binding appears
|
|
|
|
pub(crate) depth: u32,
|
2019-12-07 03:09:21 -08:00
|
|
|
/// Export binding as an environment variable to child processes
|
|
|
|
pub(crate) export: bool,
|
|
|
|
/// Binding name
|
2021-09-16 06:44:40 -07:00
|
|
|
pub(crate) name: Name<'src>,
|
2019-12-07 03:09:21 -08:00
|
|
|
/// Binding value
|
2021-09-16 06:44:40 -07:00
|
|
|
pub(crate) value: V,
|
2019-12-07 03:09:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
impl<'src, V> Keyed<'src> for Binding<'src, V> {
|
|
|
|
fn key(&self) -> &'src str {
|
|
|
|
self.name.lexeme()
|
|
|
|
}
|
|
|
|
}
|