pub struct Styler { /* private fields */ }Expand description
Lightweight style system with CSS cascade resolution.
Implementations§
Source§impl Styler
impl Styler
Sourcepub fn new(config: StyleConfig) -> Self
pub fn new(config: StyleConfig) -> Self
Create a styler with explicit config.
Sourcepub fn with_memory_budget(self, memory: MemoryBudget) -> Self
pub fn with_memory_budget(self, memory: MemoryBudget) -> Self
Override hard memory budget used in style paths.
Sourcepub fn load_stylesheets(
&mut self,
sources: &ChapterStylesheets,
) -> Result<(), RenderPrepError>
pub fn load_stylesheets( &mut self, sources: &ChapterStylesheets, ) -> Result<(), RenderPrepError>
Parse and load stylesheets in cascade order.
Sourcepub fn style_chapter(
&self,
html: &str,
) -> Result<StyledChapter, RenderPrepError>
pub fn style_chapter( &self, html: &str, ) -> Result<StyledChapter, RenderPrepError>
Style a chapter and return a stream of events and runs.
Sourcepub fn style_chapter_into(
&self,
html: &str,
out: &mut Vec<StyledEventOrRun>,
) -> Result<(), RenderPrepError>
pub fn style_chapter_into( &self, html: &str, out: &mut Vec<StyledEventOrRun>, ) -> Result<(), RenderPrepError>
Style a chapter and append results into an output buffer.
Sourcepub fn style_chapter_with<F>(
&self,
html: &str,
on_item: F,
) -> Result<(), RenderPrepError>where
F: FnMut(StyledEventOrRun),
pub fn style_chapter_with<F>(
&self,
html: &str,
on_item: F,
) -> Result<(), RenderPrepError>where
F: FnMut(StyledEventOrRun),
Style a chapter and stream each item to a callback.
Sourcepub fn style_chapter_bytes_with<F>(
&self,
html_bytes: &[u8],
on_item: F,
) -> Result<(), RenderPrepError>where
F: FnMut(StyledEventOrRun),
pub fn style_chapter_bytes_with<F>(
&self,
html_bytes: &[u8],
on_item: F,
) -> Result<(), RenderPrepError>where
F: FnMut(StyledEventOrRun),
Style a chapter from XHTML bytes and stream each item to a callback.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Styler
impl RefUnwindSafe for Styler
impl Send for Styler
impl Sync for Styler
impl Unpin for Styler
impl UnsafeUnpin for Styler
impl UnwindSafe for Styler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more