pub struct Stages<'a> {
pub stages: Vec<Stage<'a>>,
}
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§
Source§impl<'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> Freeze for Stages<'a>
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§
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
Mutably borrows from an owned value. Read more