ligen_ir/macro_attributes/attributes/attribute/
named.rs1use std::fmt::{Display, Formatter};
2
3use crate::prelude::*;
4use crate::{Path, Literal};
5
6#[derive(Default, Debug, PartialEq, Clone, Serialize, Deserialize)]
8pub struct Named {
9    pub path: Path,
11    pub literal: Literal,
14}
15
16impl Named {
17    pub fn new<I: Into<Path>, L: Into<Literal>>(path: I, literal: L) -> Self {
19        let path = path.into();
20        let literal = literal.into();
21        Self { path, literal }
22    }
23}
24
25impl Display for Named {
26    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
27        write!(f, "{} = {}", self.path, self.literal)
28    }
29}