Skip to main content

nanite_docker/instruction/
env.rs

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