pub struct SphinxBuilder { /* private fields */ }Implementations§
Source§impl SphinxBuilder
impl SphinxBuilder
pub fn new( config: BuildConfig, source_dir: PathBuf, output_dir: PathBuf, ) -> Result<Self>
pub fn set_parallel_jobs(&mut self, jobs: usize)
pub fn enable_incremental(&mut self)
Sourcepub fn fresh_env(&mut self) -> Result<()>
pub fn fresh_env(&mut self) -> Result<()>
Discard the saved environment before building (sphinx-build -E).
Sphinx’s -E is freshenv=True: the pickled environment is not
loaded at all, and the fresh one it builds instead reports every
document as new. Emptying the cache directory is the same statement
about the other half of the persisted state (documents and
doctrees), and dropping the already-loaded environment here is what
keeps the two halves saying the same thing.
Sourcepub fn add_warning(&self, warning: BuildWarning)
pub fn add_warning(&self, warning: BuildWarning)
Add a warning to the collection
Sourcepub fn add_error(&self, error: BuildErrorReport)
pub fn add_error(&self, error: BuildErrorReport)
Add an error to the collection
Sourcepub fn should_fail_on_warning(&self) -> bool
pub fn should_fail_on_warning(&self) -> bool
Check if warnings should be treated as errors
pub async fn clean(&mut self) -> Result<()>
Sourcepub async fn build(&mut self) -> Result<BuildStats>
pub async fn build(&mut self) -> Result<BuildStats>
Run the build: read → merge → resolve → write, then validation.
The four phases mirror Sphinx’s own split (builders/__init__.py):
- read (
Self::read_phase, parallel): parse every outdated source file into aDocument+ doctree, and recover the rest from the cache. - merge (
Self::merge_phase, sequential, docname-ordered): fold each re-read document’s output into theBuildEnvironment— Sphinx’smerge_info_fromplus the collectors it dispatches — and persist that document’s doctree once those have mutated it. - resolve (
Self::resolve_phase): whole-project state that needs every document read first, then persist the environment. - write (
Self::write_phase): emit the output files.
&mut self only so the environment can be moved out and back; the
phase methods themselves take &self and the environment by
reference.
Sourcepub fn env(&self) -> &BuildEnvironment
pub fn env(&self) -> &BuildEnvironment
The environment this build produced (empty before Self::build).
Sourcepub fn snapshot_env(&self) -> Value
pub fn snapshot_env(&self) -> Value
BuildEnvironment::snapshot of this build’s environment — the
shape the env_differential oracle compares against — plus the
resolved_pformat of every document this build resolved, which is
build output rather than environment state and so has no home inside
BuildEnvironment.
Auto Trait Implementations§
impl !Freeze for SphinxBuilder
impl !RefUnwindSafe for SphinxBuilder
impl !UnwindSafe for SphinxBuilder
impl Send for SphinxBuilder
impl Sync for SphinxBuilder
impl Unpin for SphinxBuilder
impl UnsafeUnpin for SphinxBuilder
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
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> ⓘ
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> ⓘ
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