nanite_docker/instruction/onbuild.rs
1use crate::Instruction;
2use alloc::boxed::Box;
3use core::fmt::{Display, Formatter};
4
5/// Represents an `ONBUILD` instruction.
6/// ```rust
7/// use nanite_docker::{OnBuild, Instruction, Run};
8///
9/// let onbuild = OnBuild {
10/// instruction: Box::new(Instruction::Run(Run{
11/// argv: vec!["echo".into(), "hello".into()],
12/// mounts: vec![],
13/// network: None,
14/// security: None,
15/// })),
16/// };
17/// let onbuild_built = format!("{onbuild}");
18/// assert_eq!(onbuild_built, r#"ONBUILD RUN ["echo", "hello"]"#);
19/// ```
20#[derive(Clone, Debug)]
21pub struct OnBuild {
22 pub instruction: Box<Instruction>,
23}
24impl Display for OnBuild {
25 fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
26 write!(f, "ONBUILD {}", self.instruction)
27 }
28}