#[non_exhaustive]pub struct RenderContext {
pub version: String,
pub root: PathBuf,
pub book: Book,
pub config: Config,
pub destination: PathBuf,
pub chapter_titles: HashMap<PathBuf, String>,
}Expand description
The context provided to all renderers.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.version: StringWhich version of mdbook did this come from (as written in mdbook’s
Cargo.toml). Useful if you know the renderer is only compatible with
certain versions of mdbook.
root: PathBufThe book’s root directory.
book: BookA loaded representation of the book itself.
config: ConfigThe loaded configuration file.
destination: PathBufWhere the renderer must put any build artefacts generated. To allow renderers to cache intermediate results, this directory is not guaranteed to be empty or even exist.
chapter_titles: HashMap<PathBuf, String>Internal mapping of chapter titles.
This is used internally by mdbook to compute custom chapter titles. This should not be used outside of mdbook’s internals.
Implementations§
Source§impl RenderContext
impl RenderContext
Sourcepub fn new<P, Q>(
root: P,
book: Book,
config: Config,
destination: Q,
) -> RenderContext
pub fn new<P, Q>( root: P, book: Book, config: Config, destination: Q, ) -> RenderContext
Create a new RenderContext.
Sourcepub fn source_dir(&self) -> PathBuf
pub fn source_dir(&self) -> PathBuf
Get the source directory’s (absolute) path on disk.
Sourcepub fn from_json<R: Read>(reader: R) -> Result<RenderContext>
pub fn from_json<R: Read>(reader: R) -> Result<RenderContext>
Load a RenderContext from its JSON representation.
Trait Implementations§
Source§impl Clone for RenderContext
impl Clone for RenderContext
Source§fn clone(&self) -> RenderContext
fn clone(&self) -> RenderContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more