Struct dockerfile_parser::Stages
source · [−]Expand description
A collection of stages in a [multi-stage build].
Example
use dockerfile_parser::Dockerfile;
let dockerfile = Dockerfile::parse(r#"
FROM alpine:3.12 as build
RUN echo "hello world" > /foo
FROM ubuntu:18.04
COPY --from=0 /foo /foo
"#).unwrap();
for stage in dockerfile.stages() {
println!("stage #{}, name: {:?}", stage.index, stage.name)
}Fields
stages: Vec<Stage<'a>>Implementations
sourceimpl<'a> Stages<'a>
impl<'a> Stages<'a>
pub fn new(dockerfile: &'a Dockerfile) -> Stages<'a>
sourcepub fn get_by_name(&'a self, name: &str) -> Option<&'a Stage<'a>>
pub fn get_by_name(&'a self, name: &str) -> Option<&'a Stage<'a>>
Attempts to fetch a stage by its name (FROM alias).
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Stages<'a>
impl<'a> Send for Stages<'a>
impl<'a> Sync for Stages<'a>
impl<'a> Unpin for Stages<'a>
impl<'a> UnwindSafe for Stages<'a>
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