pub struct Dockerfile {
pub instructions: Vec<Instruction>,
}
Expand description
This struct represents a Dockerfile instance.
Fields§
§instructions: Vec<Instruction>
Implementations§
Source§impl Dockerfile
impl Dockerfile
Sourcepub const fn new(instructions: Vec<Instruction>) -> Self
pub const fn new(instructions: Vec<Instruction>) -> Self
Creates a new Dockerfile
instance for the given instructions.
Sourcepub fn from(path: PathBuf) -> ParseResult<Self>
pub fn from(path: PathBuf) -> ParseResult<Self>
Parses the content of the Dockerfile and returns a populated Dockerfile
instance.
The file is read line by line, preserving empty lines and comments.
§Example
use std::path::PathBuf;
use dockerfile_parser_rs::Dockerfile;
use dockerfile_parser_rs::ParseResult;
fn main() -> ParseResult<()> {
let path = PathBuf::from("./Dockerfile");
let dockerfile = Dockerfile::from(path)?;
dockerfile.print();
Ok(())
}
§Errors
Returns an error if the file cannot be opened or if there is a syntax error in the Dockerfile.
Trait Implementations§
Source§impl Clone for Dockerfile
impl Clone for Dockerfile
Source§fn clone(&self) -> Dockerfile
fn clone(&self) -> Dockerfile
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Dockerfile
impl Debug for Dockerfile
Source§impl FromStr for Dockerfile
impl FromStr for Dockerfile
Source§impl PartialEq for Dockerfile
impl PartialEq for Dockerfile
impl Eq for Dockerfile
impl StructuralPartialEq for Dockerfile
Auto Trait Implementations§
impl Freeze for Dockerfile
impl RefUnwindSafe for Dockerfile
impl Send for Dockerfile
impl Sync for Dockerfile
impl Unpin for Dockerfile
impl UnwindSafe for Dockerfile
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