1use super::*;
2
3#[derive(PartialEq, Debug, Clone, Serialize)]
5pub struct Parameter<'src> {
6 pub default: Option<Expression<'src>>,
8 pub export: bool,
10 pub kind: ParameterKind,
12 pub name: Name<'src>,
14}
15
16impl<'src> ColorDisplay for Parameter<'src> {
17 fn fmt(&self, f: &mut Formatter, color: Color) -> fmt::Result {
18 if let Some(prefix) = self.kind.prefix() {
19 write!(f, "{}", color.annotation().paint(prefix))?;
20 }
21 if self.export {
22 write!(f, "$")?;
23 }
24 write!(f, "{}", color.parameter().paint(self.name.lexeme()))?;
25 if let Some(ref default) = self.default {
26 write!(f, "={}", color.string().paint(&default.to_string()))?;
27 }
28 Ok(())
29 }
30}