Struct mdbook::renderer::RenderContext
source · [−]pub struct RenderContext {
pub version: String,
pub root: PathBuf,
pub book: Book,
pub config: Config,
pub destination: PathBuf,
/* private fields */
}
Expand description
The context provided to all renderers.
Fields
version: String
Which 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: PathBuf
The book’s root directory.
book: Book
A loaded representation of the book itself.
config: Config
The loaded configuration file.
destination: PathBuf
Where 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.
Implementations
sourceimpl RenderContext
impl RenderContext
sourcepub fn new<P, Q>(
root: P,
book: Book,
config: Config,
destination: Q
) -> RenderContext where
P: Into<PathBuf>,
Q: Into<PathBuf>,
pub fn new<P, Q>(
root: P,
book: Book,
config: Config,
destination: Q
) -> RenderContext where
P: Into<PathBuf>,
Q: Into<PathBuf>,
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
sourceimpl Clone for RenderContext
impl Clone for RenderContext
sourcefn clone(&self) -> RenderContext
fn clone(&self) -> RenderContext
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for RenderContext
impl Debug for RenderContext
sourceimpl<'de> Deserialize<'de> for RenderContext
impl<'de> Deserialize<'de> for RenderContext
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl PartialEq<RenderContext> for RenderContext
impl PartialEq<RenderContext> for RenderContext
sourcefn eq(&self, other: &RenderContext) -> bool
fn eq(&self, other: &RenderContext) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &RenderContext) -> bool
fn ne(&self, other: &RenderContext) -> bool
This method tests for !=
.
sourceimpl Serialize for RenderContext
impl Serialize for RenderContext
impl StructuralPartialEq for RenderContext
Auto Trait Implementations
impl RefUnwindSafe for RenderContext
impl Send for RenderContext
impl Sync for RenderContext
impl Unpin for RenderContext
impl UnwindSafe for RenderContext
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more