pub fn run(&mut self, status: &mut dyn StatusBackend) -> Result<()> {
        // Do we need to generate the format file?

        let generate_format = if self.output_format == OutputFormat::Format {
            false
        } else {
            let fmt_result = {
                let mut stack = self.io.as_stack();
                stack.input_open_format(OsStr::new(&self.format_name), status)
            };

            match fmt_result {
                OpenResult::Ok(_) => false,
                OpenResult::NotAvailable => true,
                OpenResult::Err(e) => {
                    return Err(e)
                        .chain_err(|| format!("could not open format file {}", self.format_name));
                }
            }
        };

        if generate_format {
            tt_note!(status, "generating format \"{}\"", self.format_name);
            self.make_format_pass(status)?;
        }

        // Do the meat of the work.

        let result = match self.pass {
            PassSetting::Tex => match self.tex_pass(None, status) {
                Ok(Some(warnings)) => {
                    tt_warning!(status, "{}", warnings);
                    Ok(0)
                }
                Ok(None) => Ok(0),
                Err(e) => Err(e),
            },
            PassSetting::Default => self.default_pass(false, status),
            PassSetting::BibtexFirst => self.default_pass(true, status),
        };

        if let Err(e) = result {
            self.write_files(None, status, true)?;
            return Err(e);
        };

        // Write output files and the first line of our Makefile output.

        let mut mf_dest_maybe = match self.makefile_output_path {
            Some(ref p) => {
                if self.output_path.is_none() {
                    tt_warning!(
                        status,
                        "requested to generate Makefile rules, but no files written to disk!"
                    );
                    None
                } else {
                    Some(File::create(p)?)
                }
            }

            None => None,
        };

        let n_skipped_intermediates = self.write_files(mf_dest_maybe.as_mut(), status, false)?;

        if n_skipped_intermediates > 0 {
            status.note_highlighted(
                "Skipped writing ",
                &format!("{}", n_skipped_intermediates),
                " intermediate files (use --keep-intermediates to keep them)",
            );
        }

        // Finish Makefile rules, maybe.

        if let Some(ref mut mf_dest) = mf_dest_maybe {
            ctry!(write!(mf_dest, ": "); "couldn't write to Makefile-rules file");

            if let Some(ref pip) = self.primary_input_path {
                ctry!(mf_dest.write_all(pip.to_string_lossy().as_ref().as_bytes()); "couldn't write to Makefile-rules file");
            }

            // The check above ensures that this is never None.
            let root = self.output_path.as_ref().unwrap();

            for (name, info) in &self.events.0 {
                if info.input_origin != InputOrigin::Filesystem {
                    continue;
                }

                if info.got_written_to_disk {
                    // If the file originally came from the filesystem, and it
                    // was written as well as read, and we actually wrote it
                    // to disk, there's a circular dependency that's
                    // inappropriate to express in a Makefile. If it was
                    // "written" by the engine but we didn't actually write
                    // those modifications to disk, we're OK. If there's a
                    // two-stage compilation involving the .aux file, the
                    // latter case is what arises unless --keep-intermediates
                    // is specified.
                    tt_warning!(
                        status,
                        "omitting circular Makefile dependency for {}",
                        name.to_string_lossy()
                    );
                    continue;
                }

                ctry!(write!(mf_dest, " \\\n  {}", root.join(name).display()); "couldn't write to Makefile-rules file");
            }

            ctry!(writeln!(mf_dest, ""); "couldn't write to Makefile-rules file");
        }

        // All done.

        Ok(())
    }
/// Runs the session, generating the desired outputs.
///
/// What this does depends on which [`PassSetting`] you asked for. The most common choice is
/// `PassSetting::Default`, in which case this method does the following:
///
/// - if a `.fmt` file does not yet exist, generate one and cache it
/// - run the TeX engine once
/// - run BibTeX, if it seems to be required
/// - repeat the last two steps as often as needed
/// - write the output files to disk, including a Makefile if it was requested.
Runs the session, generating the desired outputs.
What this does depends on which [`PassSetting`] you asked for. The most common choice is
`PassSetting::Default`, in which case this method does the following.

if a `.fmt` file does not yet exist, generate one and cache it
run the TeX engine once
run BibTeX, if it seems to be required
repeat the last two steps as often as needed
write the output files to disk, including a Makefile if it was requested.
Runs the session generating the desired outputs . What this does depends on which [ ` PassSetting ` ] you asked for . The most common choice is ` PassSetting :: Default ` in which case this method does the following . if a ` . fmt ` file does not yet exist generate one and cache it run the TeX engine once run BibTeX if it seems to be required repeat the last two steps as often as needed write the output files to disk including a Makefile if it was requested .
pub fn run(&mut self, status: &mut dyn StatusBackend) -> Result<()> {
        // Do we need to generate the format file?
        let generate_format = if self.output_format == OutputFormat::Format {
            false
        } else {
            let fmt_result = {
                let mut stack = self.io.as_stack();
                stack.input_open_format(OsStr::new(&self.format_name), status)
            };
            match fmt_result {
                OpenResult::Ok(_) => false,
                OpenResult::NotAvailable => true,
                OpenResult::Err(e) => {
                    return Err(e)
                        .chain_err(|| format!("could not open format file {}", self.format_name));
                }
            }
        };
        if generate_format {
            tt_note!(status, "generating format \"{}\"", self.format_name);
            self.make_format_pass(status)?;
        }
        // Do the meat of the work.
        let result = match self.pass {
            PassSetting::Tex => match self.tex_pass(None, status) {
                Ok(Some(warnings)) => {
                    tt_warning!(status, "{}", warnings);
                    Ok(0)
                }
                Ok(None) => Ok(0),
                Err(e) => Err(e),
            },
            PassSetting::Default => self.default_pass(false, status),
            PassSetting::BibtexFirst => self.default_pass(true, status),
        };
        if let Err(e) = result {
            self.write_files(None, status, true)?;
            return Err(e);
        };
        // Write output files and the first line of our Makefile output.
        let mut mf_dest_maybe = match self.makefile_output_path {
            Some(ref p) => {
                if self.output_path.is_none() {
                    tt_warning!(
                        status,
                        "requested to generate Makefile rules, but no files written to disk!"
                    );
                    None
                } else {
                    Some(File::create(p)?)
                }
            }
            None => None,
        };
        let n_skipped_intermediates = self.write_files(mf_dest_maybe.as_mut(), status, false)?;
        if n_skipped_intermediates > 0 {
            status.note_highlighted(
                "Skipped writing ",
                &format!("{}", n_skipped_intermediates),
                " intermediate files (use --keep-intermediates to keep them)",
            );
        }
        // Finish Makefile rules, maybe.
        if let Some(ref mut mf_dest) = mf_dest_maybe {
            ctry!(write!(mf_dest, ": "); "couldn't write to Makefile-rules file");
            if let Some(ref pip) = self.primary_input_path {
                ctry!(mf_dest.write_all(pip.to_string_lossy().as_ref().as_bytes()); "couldn't write to Makefile-rules file");
            }
            // The check above ensures that this is never None.
            let root = self.output_path.as_ref().unwrap();
            for (name, info) in &self.events.0 {
                if info.input_origin != InputOrigin::Filesystem {
                    continue;
                }
                if info.got_written_to_disk {
                    // If the file originally came from the filesystem, and it
                    // was written as well as read, and we actually wrote it
                    // to disk, there's a circular dependency that's
                    // inappropriate to express in a Makefile. If it was
                    // "written" by the engine but we didn't actually write
                    // those modifications to disk, we're OK. If there's a
                    // two-stage compilation involving the .aux file, the
                    // latter case is what arises unless --keep-intermediates
                    // is specified.
                    tt_warning!(
                        status,
                        "omitting circular Makefile dependency for {}",
                        name.to_string_lossy()
                    );
                    continue;
                }
                ctry!(write!(mf_dest, " \\\n  {}", root.join(name).display()); "couldn't write to Makefile-rules file");
            }
            ctry!(writeln!(mf_dest, ""); "couldn't write to Makefile-rules file");
        }
        // All done.
        Ok(())
    }
pub fn run ( & mut self , status : & mut dyn StatusBackend ) -> Result < ( ) > { // Do we need to generate the format file? let generate_format = if self . output_format == OutputFormat :: Format { false } else { let fmt_result = { let mut stack = self . io . as_stack ( ) ; stack . input_open_format ( OsStr :: new ( & self . format_name ) , status ) } ; match fmt_result { OpenResult :: Ok ( _ ) => false , OpenResult :: NotAvailable => true , OpenResult :: Err ( e ) => { return Err ( e ) . chain_err ( | | format ! ( " " self format_name ) ) ; } } } ; if generate_format { tt_note ! ( status " \" \" " self format_name ) ; self . make_format_pass ( status ) ? ; } // Do the meat of the work. let result = match self . pass { PassSetting :: Tex => match self . tex_pass ( None , status ) { Ok ( Some ( warnings ) ) => { tt_warning ! ( status " " warnings ) ; Ok ( 0 ) } Ok ( None ) => Ok ( 0 ) , Err ( e ) => Err ( e ) , } , PassSetting :: Default => self . default_pass ( false , status ) , PassSetting :: BibtexFirst => self . default_pass ( true , status ) , } ; if let Err ( e ) = result { self . write_files ( None , status , true ) ? ; return Err ( e ) ; } ; // Write output files and the first line of our Makefile output. let mut mf_dest_maybe = match self . makefile_output_path { Some ( ref p ) => { if self . output_path . is_none ( ) { tt_warning ! ( status " " ) ; None } else { Some ( File :: create ( p ) ? ) } } None => None , } ; let n_skipped_intermediates = self . write_files ( mf_dest_maybe . as_mut ( ) , status , false ) ? ; if n_skipped_intermediates > 0 { status . note_highlighted ( " " , & format ! ( " " n_skipped_intermediates ) , " " , ) ; } // Finish Makefile rules, maybe. if let Some ( ref mut mf_dest ) = mf_dest_maybe { ctry ! ( write ( mf_dest " " ) " " ) ; if let Some ( ref pip ) = self . primary_input_path { ctry ! ( mf_dest write_all ( pip to_string_lossy ( ) as_ref ( ) as_bytes ( ) ) " " ) ; } // The check above ensures that this is never None. let root = self . output_path . as_ref ( ) . unwrap ( ) ; for ( name , info ) in & self . events . 0 { if info . input_origin != InputOrigin :: Filesystem { continue ; } if info . got_written_to_disk { // If the file originally came from the filesystem, and it // was written as well as read, and we actually wrote it // to disk, there's a circular dependency that's // inappropriate to express in a Makefile. If it was // "written" by the engine but we didn't actually write // those modifications to disk, we're OK. If there's a // two-stage compilation involving the .aux file, the // latter case is what arises unless --keep-intermediates // is specified. tt_warning ! ( status " " name to_string_lossy ( ) ) ; continue ; } ctry ! ( write ( mf_dest " \\ \n " root join ( name ) display ( ) ) " " ) ; } ctry ! ( writeln ( mf_dest " " ) " " ) ; } // All done. Ok ( ( ) ) }
Runs the session, generating the desired outputs.
Runs the session generating the desired outputs .
&mut self
status
&mut dyn StatusBackend