nanite_docker/instruction/label.rs
1use alloc::string::String;
2use core::fmt::{Display, Formatter};
3
4/// Represents a `LABEL` instruction
5/// ```rust
6/// use nanite_docker::{Label};
7///
8/// let label = Label {
9/// key: "key".to_string(),
10/// value: "value".to_string(),
11/// };
12/// let label_built = format!("{label}");
13/// assert_eq!(label_built, "LABEL key=value");
14/// ```
15#[derive(Clone, Debug)]
16pub struct Label {
17 pub key: String,
18 pub value: String,
19}
20
21impl Display for Label {
22 fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
23 write!(f, "LABEL {}={}", self.key, self.value)
24 }
25}