Skip to main content

SphinxBuilder

Struct SphinxBuilder 

Source
pub struct SphinxBuilder { /* private fields */ }

Implementations§

Source§

impl SphinxBuilder

Source

pub fn new( config: BuildConfig, source_dir: PathBuf, output_dir: PathBuf, ) -> Result<Self>

Source

pub fn set_parallel_jobs(&mut self, jobs: usize)

Source

pub fn enable_incremental(&mut self)

Source

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.

Source

pub fn add_warning(&self, warning: BuildWarning)

Add a warning to the collection

Source

pub fn add_error(&self, error: BuildErrorReport)

Add an error to the collection

Source

pub fn should_fail_on_warning(&self) -> bool

Check if warnings should be treated as errors

Source

pub async fn clean(&mut self) -> Result<()>

Source

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 a Document + doctree, and recover the rest from the cache.
  • merge (Self::merge_phase, sequential, docname-ordered): fold each re-read document’s output into the BuildEnvironment — Sphinx’s merge_info_from plus 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.

Source

pub fn env(&self) -> &BuildEnvironment

The environment this build produced (empty before Self::build).

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.