Skip to content

Commit

Permalink
fix: improve rendering API
Browse files Browse the repository at this point in the history
  • Loading branch information
nfejzic committed Dec 8, 2023
1 parent 9f7fae9 commit 6e2fe87
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,20 @@ impl MathMl {
}

/// Write this `math` element and its children using the given writer.
pub fn write<W: Writer>(&self, writer: &mut W) -> Result<W::Buffer, W::Error> {
pub fn write<'writer, W: Writer>(
&self,
writer: &'writer mut W,
) -> Result<&'writer mut W, W::Error> {
writer.write_mathml(self)?;
Ok(writer.finish())
Ok(writer)
}

/// Render this `math` element and its children using the default renderer.
///
/// In this implementation, [`BufMathMlWriter`] is used.
pub fn render(&self) -> Result<String, <BufMathMlWriter as crate::Writer>::Error> {
self.write(&mut BufMathMlWriter::default())
.map(|w| w.finish())
}
}

Expand Down

0 comments on commit 6e2fe87

Please sign in to comment.