pub enum Instruction {
From(FromInstruction),
Arg(ArgInstruction),
Label(LabelInstruction),
Run(RunInstruction),
Entrypoint(EntrypointInstruction),
Cmd(CmdInstruction),
Copy(CopyInstruction),
Env(EnvInstruction),
Misc(MiscInstruction),
}
Expand description
A single Dockerfile instruction.
Individual instructions structures may be unpacked with pattern matching or
via the TryFrom
impls on each instruction type.
§Example
use std::convert::TryInto;
use dockerfile_parser::*;
let dockerfile = Dockerfile::parse("FROM alpine:3.11").unwrap();
let from: &FromInstruction = dockerfile.instructions
.get(0).unwrap()
.try_into().unwrap();
assert_eq!(from.image_parsed.tag, Some("3.11".to_string()));
Variants§
From(FromInstruction)
Arg(ArgInstruction)
Label(LabelInstruction)
Run(RunInstruction)
Entrypoint(EntrypointInstruction)
Cmd(CmdInstruction)
Copy(CopyInstruction)
Env(EnvInstruction)
Misc(MiscInstruction)
Implementations§
Source§impl Instruction
impl Instruction
Sourcepub fn into_from(self) -> Option<FromInstruction>
pub fn into_from(self) -> Option<FromInstruction>
Attempts to convert this instruction into a FromInstruction, returning None if impossible.
Sourcepub fn as_from(&self) -> Option<&FromInstruction>
pub fn as_from(&self) -> Option<&FromInstruction>
Attempts to convert this instruction into a FromInstruction, returning None if impossible.
Sourcepub fn into_arg(self) -> Option<ArgInstruction>
pub fn into_arg(self) -> Option<ArgInstruction>
Attempts to convert this instruction into an ArgInstruction, returning None if impossible.
Sourcepub fn as_arg(&self) -> Option<&ArgInstruction>
pub fn as_arg(&self) -> Option<&ArgInstruction>
Attempts to convert this instruction into an ArgInstruction, returning None if impossible.
Sourcepub fn into_label(self) -> Option<LabelInstruction>
pub fn into_label(self) -> Option<LabelInstruction>
Attempts to convert this instruction into a LabelInstruction, returning None if impossible.
Sourcepub fn as_label(&self) -> Option<&LabelInstruction>
pub fn as_label(&self) -> Option<&LabelInstruction>
Attempts to convert this instruction into a LabelInstruction, returning None if impossible.
Sourcepub fn into_run(self) -> Option<RunInstruction>
pub fn into_run(self) -> Option<RunInstruction>
Attempts to convert this instruction into a RunInstruction, returning None if impossible.
Sourcepub fn as_run(&self) -> Option<&RunInstruction>
pub fn as_run(&self) -> Option<&RunInstruction>
Attempts to convert this instruction into a RunInstruction, returning None if impossible.
Sourcepub fn into_entrypoint(self) -> Option<EntrypointInstruction>
pub fn into_entrypoint(self) -> Option<EntrypointInstruction>
Attempts to convert this instruction into an EntrypointInstruction, returning None if impossible.
Sourcepub fn as_entrypoint(&self) -> Option<&EntrypointInstruction>
pub fn as_entrypoint(&self) -> Option<&EntrypointInstruction>
Attempts to convert this instruction into an EntrypointInstruction, returning None if impossible.
Sourcepub fn into_cmd(self) -> Option<CmdInstruction>
pub fn into_cmd(self) -> Option<CmdInstruction>
Attempts to convert this instruction into a CmdInstruction, returning None if impossible.
Sourcepub fn as_cmd(&self) -> Option<&CmdInstruction>
pub fn as_cmd(&self) -> Option<&CmdInstruction>
Attempts to convert this instruction into a CmdInstruction, returning None if impossible.
Sourcepub fn into_copy(self) -> Option<CopyInstruction>
pub fn into_copy(self) -> Option<CopyInstruction>
Attempts to convert this instruction into a CopyInstruction, returning None if impossible.
Sourcepub fn as_copy(&self) -> Option<&CopyInstruction>
pub fn as_copy(&self) -> Option<&CopyInstruction>
Attempts to convert this instruction into a CopyInstruction, returning None if impossible.
Sourcepub fn into_env(self) -> Option<EnvInstruction>
pub fn into_env(self) -> Option<EnvInstruction>
Attempts to convert this instruction into an EnvInstruction, returning None if impossible.
Sourcepub fn as_env(&self) -> Option<&EnvInstruction>
pub fn as_env(&self) -> Option<&EnvInstruction>
Attempts to convert this instruction into an EnvInstruction, returning None if impossible.
Sourcepub fn into_misc(self) -> Option<MiscInstruction>
pub fn into_misc(self) -> Option<MiscInstruction>
Attempts to convert this instruction into a MiscInstruction, returning None if impossible.
Sourcepub fn as_misc(&self) -> Option<&MiscInstruction>
pub fn as_misc(&self) -> Option<&MiscInstruction>
Attempts to convert this instruction into a MiscInstruction, returning None if impossible.
Trait Implementations§
Source§impl Clone for Instruction
impl Clone for Instruction
Source§fn clone(&self) -> Instruction
fn clone(&self) -> Instruction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more