Skip to content

Commit

Permalink
Makes ElementWriter.write_inner_content take FnOnce instead of Fn
Browse files Browse the repository at this point in the history
This closure is only evaluated once
  • Loading branch information
Tpt authored and dralley committed Mar 17, 2023
1 parent 642de0a commit dd4c89e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

### Misc Changes

- [#579]: `ElementWriter.write_inner_content` now uses a `FnOnce` instead of a more restrictive `Fn` closure


## 0.28.0 -- 2023-03-13

Expand Down
2 changes: 1 addition & 1 deletion src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ impl<'a, W: Write> ElementWriter<'a, W> {
/// Create a new scope for writing XML inside the current element.
pub fn write_inner_content<F>(self, closure: F) -> Result<&'a mut Writer<W>>
where
F: Fn(&mut Writer<W>) -> Result<()>,
F: FnOnce(&mut Writer<W>) -> Result<()>,
{
self.writer
.write_event(Event::Start(self.start_tag.borrow()))?;
Expand Down

0 comments on commit dd4c89e

Please sign in to comment.