[][src]Enum dockerfile_parser::Instruction

pub enum Instruction {
    From(FromInstruction),
    Arg(ArgInstruction),
    Label(LabelInstruction),
    Run(RunInstruction),
    Entrypoint(EntrypointInstruction),
    Cmd(CmdInstruction),
    Copy(CopyInstruction),
    Env(EnvInstruction),
    Misc(MiscInstruction),
}

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

Implementations

impl Instruction[src]

pub fn into_from(self) -> Option<FromInstruction>[src]

Attempts to convert this instruction into a FromInstruction, returning None if impossible.

pub fn as_from(&self) -> Option<&FromInstruction>[src]

Attempts to convert this instruction into a FromInstruction, returning None if impossible.

pub fn into_arg(self) -> Option<ArgInstruction>[src]

Attempts to convert this instruction into an ArgInstruction, returning None if impossible.

pub fn as_arg(&self) -> Option<&ArgInstruction>[src]

Attempts to convert this instruction into an ArgInstruction, returning None if impossible.

pub fn into_label(self) -> Option<LabelInstruction>[src]

Attempts to convert this instruction into a LabelInstruction, returning None if impossible.

pub fn as_label(&self) -> Option<&LabelInstruction>[src]

Attempts to convert this instruction into a LabelInstruction, returning None if impossible.

pub fn into_run(self) -> Option<RunInstruction>[src]

Attempts to convert this instruction into a RunInstruction, returning None if impossible.

pub fn as_run(&self) -> Option<&RunInstruction>[src]

Attempts to convert this instruction into a RunInstruction, returning None if impossible.

pub fn into_entrypoint(self) -> Option<EntrypointInstruction>[src]

Attempts to convert this instruction into an EntrypointInstruction, returning None if impossible.

pub fn as_entrypoint(&self) -> Option<&EntrypointInstruction>[src]

Attempts to convert this instruction into an EntrypointInstruction, returning None if impossible.

pub fn into_cmd(self) -> Option<CmdInstruction>[src]

Attempts to convert this instruction into a CmdInstruction, returning None if impossible.

pub fn as_cmd(&self) -> Option<&CmdInstruction>[src]

Attempts to convert this instruction into a CmdInstruction, returning None if impossible.

pub fn into_copy(self) -> Option<CopyInstruction>[src]

Attempts to convert this instruction into a CopyInstruction, returning None if impossible.

pub fn as_copy(&self) -> Option<&CopyInstruction>[src]

Attempts to convert this instruction into a CopyInstruction, returning None if impossible.

pub fn into_env(self) -> Option<EnvInstruction>[src]

Attempts to convert this instruction into an EnvInstruction, returning None if impossible.

pub fn as_env(&self) -> Option<&EnvInstruction>[src]

Attempts to convert this instruction into an EnvInstruction, returning None if impossible.

pub fn into_misc(self) -> Option<MiscInstruction>[src]

Attempts to convert this instruction into a MiscInstruction, returning None if impossible.

pub fn as_misc(&self) -> Option<&MiscInstruction>[src]

Attempts to convert this instruction into a MiscInstruction, returning None if impossible.

Trait Implementations

impl Clone for Instruction[src]

impl Debug for Instruction[src]

impl Eq for Instruction[src]

impl From<ArgInstruction> for Instruction[src]

impl From<CmdInstruction> for Instruction[src]

impl From<CopyInstruction> for Instruction[src]

impl From<EntrypointInstruction> for Instruction[src]

impl From<EnvInstruction> for Instruction[src]

impl From<FromInstruction> for Instruction[src]

impl From<LabelInstruction> for Instruction[src]

impl From<MiscInstruction> for Instruction[src]

impl From<RunInstruction> for Instruction[src]

impl PartialEq<Instruction> for Instruction[src]

impl StructuralEq for Instruction[src]

impl StructuralPartialEq for Instruction[src]

impl<'a> TryFrom<&'a Instruction> for &'a FromInstruction[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a Instruction> for &'a CopyInstruction[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a Instruction> for &'a ArgInstruction[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a Instruction> for &'a LabelInstruction[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a Instruction> for &'a EnvInstruction[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a Instruction> for &'a RunInstruction[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a Instruction> for &'a CmdInstruction[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a Instruction> for &'a MiscInstruction[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Instruction> for EntrypointInstruction[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'_> TryFrom<Pair<'_, Rule>> for Instruction[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.