Enum dockerfile_parser::Instruction
source · [−]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
sourceimpl 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
sourceimpl Clone for Instruction
impl Clone for Instruction
sourcefn clone(&self) -> Instruction
fn clone(&self) -> Instruction
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for Instruction
impl Debug for Instruction
sourceimpl From<ArgInstruction> for Instruction
impl From<ArgInstruction> for Instruction
sourcefn from(ins: ArgInstruction) -> Self
fn from(ins: ArgInstruction) -> Self
Converts to this type from the input type.
sourceimpl From<CmdInstruction> for Instruction
impl From<CmdInstruction> for Instruction
sourcefn from(ins: CmdInstruction) -> Self
fn from(ins: CmdInstruction) -> Self
Converts to this type from the input type.
sourceimpl From<CopyInstruction> for Instruction
impl From<CopyInstruction> for Instruction
sourcefn from(ins: CopyInstruction) -> Self
fn from(ins: CopyInstruction) -> Self
Converts to this type from the input type.
sourceimpl From<EntrypointInstruction> for Instruction
impl From<EntrypointInstruction> for Instruction
sourcefn from(ins: EntrypointInstruction) -> Self
fn from(ins: EntrypointInstruction) -> Self
Converts to this type from the input type.
sourceimpl From<EnvInstruction> for Instruction
impl From<EnvInstruction> for Instruction
sourcefn from(ins: EnvInstruction) -> Self
fn from(ins: EnvInstruction) -> Self
Converts to this type from the input type.
sourceimpl From<FromInstruction> for Instruction
impl From<FromInstruction> for Instruction
sourcefn from(ins: FromInstruction) -> Self
fn from(ins: FromInstruction) -> Self
Converts to this type from the input type.
sourceimpl From<LabelInstruction> for Instruction
impl From<LabelInstruction> for Instruction
sourcefn from(ins: LabelInstruction) -> Self
fn from(ins: LabelInstruction) -> Self
Converts to this type from the input type.
sourceimpl From<MiscInstruction> for Instruction
impl From<MiscInstruction> for Instruction
sourcefn from(ins: MiscInstruction) -> Self
fn from(ins: MiscInstruction) -> Self
Converts to this type from the input type.
sourceimpl From<RunInstruction> for Instruction
impl From<RunInstruction> for Instruction
sourcefn from(ins: RunInstruction) -> Self
fn from(ins: RunInstruction) -> Self
Converts to this type from the input type.
sourceimpl PartialEq<Instruction> for Instruction
impl PartialEq<Instruction> for Instruction
sourcefn eq(&self, other: &Instruction) -> bool
fn eq(&self, other: &Instruction) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &Instruction) -> bool
fn ne(&self, other: &Instruction) -> bool
This method tests for !=.
sourceimpl<'a> TryFrom<&'a Instruction> for &'a ArgInstruction
impl<'a> TryFrom<&'a Instruction> for &'a ArgInstruction
sourceimpl<'a> TryFrom<&'a Instruction> for &'a CmdInstruction
impl<'a> TryFrom<&'a Instruction> for &'a CmdInstruction
sourceimpl<'a> TryFrom<&'a Instruction> for &'a CopyInstruction
impl<'a> TryFrom<&'a Instruction> for &'a CopyInstruction
sourceimpl<'a> TryFrom<&'a Instruction> for &'a EnvInstruction
impl<'a> TryFrom<&'a Instruction> for &'a EnvInstruction
sourceimpl<'a> TryFrom<&'a Instruction> for &'a FromInstruction
impl<'a> TryFrom<&'a Instruction> for &'a FromInstruction
sourceimpl<'a> TryFrom<&'a Instruction> for &'a LabelInstruction
impl<'a> TryFrom<&'a Instruction> for &'a LabelInstruction
sourceimpl<'a> TryFrom<&'a Instruction> for &'a MiscInstruction
impl<'a> TryFrom<&'a Instruction> for &'a MiscInstruction
sourceimpl<'a> TryFrom<&'a Instruction> for &'a RunInstruction
impl<'a> TryFrom<&'a Instruction> for &'a RunInstruction
sourceimpl TryFrom<Instruction> for EntrypointInstruction
impl TryFrom<Instruction> for EntrypointInstruction
sourceimpl TryFrom<Pair<'_, Rule>> for Instruction
impl TryFrom<Pair<'_, Rule>> for Instruction
impl Eq for Instruction
impl StructuralEq for Instruction
impl StructuralPartialEq for Instruction
Auto Trait Implementations
impl RefUnwindSafe for Instruction
impl Send for Instruction
impl Sync for Instruction
impl Unpin for Instruction
impl UnwindSafe for Instruction
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more