Struct mdbook::renderer::CmdRenderer
source · [−]pub struct CmdRenderer { /* private fields */ }
Expand description
A generic renderer which will shell out to an arbitrary executable.
Rendering Protocol
When the renderer’s render()
method is invoked, CmdRenderer
will spawn
the cmd
as a subprocess. The RenderContext
is passed to the subprocess
as a JSON string (using serde_json
).
Note: The command used doesn’t necessarily need to be a single executable (i.e.
/path/to/renderer
). Thecmd
string lets you pass in command line arguments, so there’s no reason why it couldn’t bepython /path/to/renderer --from mdbook --to epub
.
Anything the subprocess writes to stdin
or stdout
will be passed through
to the user. While this gives the renderer maximum flexibility to output
whatever it wants, to avoid spamming users it is recommended to avoid
unnecessary output.
To help choose the appropriate output level, the RUST_LOG
environment
variable will be passed through to the subprocess, if set.
If the subprocess wishes to indicate that rendering failed, it should exit with a non-zero return code.
Implementations
sourceimpl CmdRenderer
impl CmdRenderer
sourcepub fn new(name: String, cmd: String) -> CmdRenderer
pub fn new(name: String, cmd: String) -> CmdRenderer
Create a new CmdRenderer
which will invoke the provided cmd
string.
Trait Implementations
sourceimpl Clone for CmdRenderer
impl Clone for CmdRenderer
sourcefn clone(&self) -> CmdRenderer
fn clone(&self) -> CmdRenderer
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 CmdRenderer
impl Debug for CmdRenderer
sourceimpl PartialEq<CmdRenderer> for CmdRenderer
impl PartialEq<CmdRenderer> for CmdRenderer
sourcefn eq(&self, other: &CmdRenderer) -> bool
fn eq(&self, other: &CmdRenderer) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &CmdRenderer) -> bool
fn ne(&self, other: &CmdRenderer) -> bool
This method tests for !=
.
sourceimpl Renderer for CmdRenderer
impl Renderer for CmdRenderer
impl StructuralPartialEq for CmdRenderer
Auto Trait Implementations
impl RefUnwindSafe for CmdRenderer
impl Send for CmdRenderer
impl Sync for CmdRenderer
impl Unpin for CmdRenderer
impl UnwindSafe for CmdRenderer
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