Skip to content

Add accessors to underlying writer: .get_ref() and .get_mut() #568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
to trim leading and trailing spaces from text events
- [#565]: Allow deserialize special field names `$value` and `$text` into borrowed
fields when use serde deserializer
- [#568]: Rename `Writter::inner` into `Writter::get_mut`
- [#568]: Add method `Writter::get_ref`

### Bug Fixes

Expand Down Expand Up @@ -50,6 +52,7 @@
[#556]: https://github.com/tafia/quick-xml/pull/556
[#562]: https://github.com/tafia/quick-xml/pull/562
[#565]: https://github.com/tafia/quick-xml/pull/565
[#568]: https://github.com/tafia/quick-xml/pull/568

## 0.27.1 -- 2022-12-28

Expand Down
9 changes: 7 additions & 2 deletions src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,16 @@ impl<W: Write> Writer<W> {
self.writer
}

/// Get inner writer, keeping ownership
pub fn inner(&mut self) -> &mut W {
/// Get a mutable reference to the underlying writer.
pub fn get_mut(&mut self) -> &mut W {
&mut self.writer
}

/// Get a reference to the underlying writer.
pub fn get_ref(&self) -> &W {
&self.writer
}

/// Write a [Byte-Order-Mark] character to the document.
///
/// # Example
Expand Down