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 moreSource§impl Debug for Instruction
impl Debug for Instruction
Source§impl From<ArgInstruction> for Instruction
impl From<ArgInstruction> for Instruction
Source§fn from(ins: ArgInstruction) -> Self
fn from(ins: ArgInstruction) -> Self
Source§impl From<CmdInstruction> for Instruction
impl From<CmdInstruction> for Instruction
Source§fn from(ins: CmdInstruction) -> Self
fn from(ins: CmdInstruction) -> Self
Source§impl From<CopyInstruction> for Instruction
impl From<CopyInstruction> for Instruction
Source§fn from(ins: CopyInstruction) -> Self
fn from(ins: CopyInstruction) -> Self
Source§impl From<EntrypointInstruction> for Instruction
impl From<EntrypointInstruction> for Instruction
Source§fn from(ins: EntrypointInstruction) -> Self
fn from(ins: EntrypointInstruction) -> Self
Source§impl From<EnvInstruction> for Instruction
impl From<EnvInstruction> for Instruction
Source§fn from(ins: EnvInstruction) -> Self
fn from(ins: EnvInstruction) -> Self
Source§impl From<FromInstruction> for Instruction
impl From<FromInstruction> for Instruction
Source§fn from(ins: FromInstruction) -> Self
fn from(ins: FromInstruction) -> Self
Source§impl From<LabelInstruction> for Instruction
impl From<LabelInstruction> for Instruction
Source§fn from(ins: LabelInstruction) -> Self
fn from(ins: LabelInstruction) -> Self
Source§impl From<MiscInstruction> for Instruction
impl From<MiscInstruction> for Instruction
Source§fn from(ins: MiscInstruction) -> Self
fn from(ins: MiscInstruction) -> Self
Source§impl From<RunInstruction> for Instruction
impl From<RunInstruction> for Instruction
Source§fn from(ins: RunInstruction) -> Self
fn from(ins: RunInstruction) -> Self
Source§impl PartialEq for Instruction
impl PartialEq for Instruction
Source§impl<'a> TryFrom<&'a Instruction> for &'a ArgInstruction
impl<'a> TryFrom<&'a Instruction> for &'a ArgInstruction
Source§impl<'a> TryFrom<&'a Instruction> for &'a CmdInstruction
impl<'a> TryFrom<&'a Instruction> for &'a CmdInstruction
Source§impl<'a> TryFrom<&'a Instruction> for &'a CopyInstruction
impl<'a> TryFrom<&'a Instruction> for &'a CopyInstruction
Source§impl<'a> TryFrom<&'a Instruction> for &'a EnvInstruction
impl<'a> TryFrom<&'a Instruction> for &'a EnvInstruction
Source§impl<'a> TryFrom<&'a Instruction> for &'a FromInstruction
impl<'a> TryFrom<&'a Instruction> for &'a FromInstruction
Source§impl<'a> TryFrom<&'a Instruction> for &'a LabelInstruction
impl<'a> TryFrom<&'a Instruction> for &'a LabelInstruction
Source§impl<'a> TryFrom<&'a Instruction> for &'a MiscInstruction
impl<'a> TryFrom<&'a Instruction> for &'a MiscInstruction
Source§impl<'a> TryFrom<&'a Instruction> for &'a RunInstruction
impl<'a> TryFrom<&'a Instruction> for &'a RunInstruction
Source§impl TryFrom<Instruction> for EntrypointInstruction
impl TryFrom<Instruction> for EntrypointInstruction
impl Eq for Instruction
impl StructuralPartialEq for Instruction
Auto Trait Implementations§
impl Freeze for Instruction
impl RefUnwindSafe for Instruction
impl Send for Instruction
impl Sync for Instruction
impl Unpin for Instruction
impl UnwindSafe for Instruction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)