pub struct CodeToPdf { /* private fields */ }
Expand description
Main struct for generating PDFs. It handles almost the entire process of reading and highlighting code, as well as actually writing it to the PDF
Implementations§
Source§impl CodeToPdf
impl CodeToPdf
Sourcepub fn new(
doc: Arc<Mutex<DocumentSubset>>,
font_id: FontId,
page_dimensions: Dimensions,
text_wrapper: TextWrapper,
page_text: Option<ProcessedText>,
include_path: bool,
) -> Self
pub fn new( doc: Arc<Mutex<DocumentSubset>>, font_id: FontId, page_dimensions: Dimensions, text_wrapper: TextWrapper, page_text: Option<ProcessedText>, include_path: bool, ) -> Self
Initialises a new CodeToPdf
Sourcepub fn process_file(
&mut self,
file: &Path,
highlighter_config: &HighlighterConfig,
index: usize,
) -> Result<(), Box<dyn Error>>
pub fn process_file( &mut self, file: &Path, highlighter_config: &HighlighterConfig, index: usize, ) -> Result<(), Box<dyn Error>>
Generates pages for a file
Sourcepub fn process_files(
&mut self,
walker: Walk,
highlighter_config: HighlighterConfig,
)
pub fn process_files( &mut self, walker: Walk, highlighter_config: HighlighterConfig, )
Consumes entire walker
Sourcepub fn processed_file_count(&self) -> usize
pub fn processed_file_count(&self) -> usize
Returns number of files processed by CodeToPdf::process_files
Source§impl CodeToPdf
impl CodeToPdf
Sourcepub fn run_parallel(
font_id: FontId,
font_bytes: &[u8],
path: PathBuf,
exclusions: Vec<String>,
page_dimensions: Dimensions,
font_size: f32,
page_text: Option<String>,
include_path: bool,
threads: Option<NonZeroU8>,
) -> (Arc<Mutex<DocumentSubset>>, usize)
pub fn run_parallel( font_id: FontId, font_bytes: &[u8], path: PathBuf, exclusions: Vec<String>, page_dimensions: Dimensions, font_size: f32, page_text: Option<String>, include_path: bool, threads: Option<NonZeroU8>, ) -> (Arc<Mutex<DocumentSubset>>, usize)
Helper function that handles everything for the basic use-case
Auto Trait Implementations§
impl Freeze for CodeToPdf
impl RefUnwindSafe for CodeToPdf
impl Send for CodeToPdf
impl Sync for CodeToPdf
impl Unpin for CodeToPdf
impl UnwindSafe for CodeToPdf
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more