src/backend/render.rs: updates to use BufWriter instead of Write trait
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
use std::{
|
use std::{
|
||||||
error::Error,
|
error::Error,
|
||||||
fmt::{ self, Display, Formatter },
|
fmt::{ self, Display, Formatter },
|
||||||
io::Write,
|
io::{ BufWriter, Write },
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -131,8 +131,8 @@ impl Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Render a page to a Write-able stream
|
/// Render a page to a Write-able stream
|
||||||
pub fn render(
|
pub fn render<W: Write>(
|
||||||
&self, mut dest: Box<dyn Write>
|
&self, dest: &mut BufWriter<W>
|
||||||
) -> Result<(), Box<dyn Error>> {
|
) -> Result<(), Box<dyn Error>> {
|
||||||
/* TODO: replace ./assets/ with the actual templates directory,
|
/* TODO: replace ./assets/ with the actual templates directory,
|
||||||
* i.e. /usr/local/share/mintee/ */
|
* i.e. /usr/local/share/mintee/ */
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
use std::{
|
use std::{
|
||||||
env::current_dir,
|
env::current_dir,
|
||||||
error::Error,
|
error::Error,
|
||||||
io::stdout,
|
io::{ BufWriter, stdout }
|
||||||
};
|
};
|
||||||
|
|
||||||
use mintee::backend::render::{ Page, PageKind, Repo };
|
use mintee::backend::render::{ Page, PageKind, Repo };
|
||||||
@@ -40,7 +40,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
entity,
|
entity,
|
||||||
name,
|
name,
|
||||||
None,
|
None,
|
||||||
Some("src".to_string()),
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let page = Page::new(
|
let page = Page::new(
|
||||||
@@ -48,5 +48,5 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
page.render(Box::new(stdout()))
|
page.render(&mut BufWriter::new(stdout()))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user