Enum dockerfile_parser::Instruction[][src]

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)

Tuple Fields

Arg(ArgInstruction)

Tuple Fields

Label(LabelInstruction)

Tuple Fields

Run(RunInstruction)

Tuple Fields

Entrypoint(EntrypointInstruction)

Tuple Fields

Cmd(CmdInstruction)

Tuple Fields

Copy(CopyInstruction)

Tuple Fields

Env(EnvInstruction)

Tuple Fields

Misc(MiscInstruction)

Tuple Fields

Implementations

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Gets the span of the instruction.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.