Skip to content

Commit

Permalink
Don't unnecessarily restrict create_element to borrowed names
Browse files Browse the repository at this point in the history
  • Loading branch information
2xsaiko committed Feb 21, 2024
1 parent 88aa477 commit 7e8a003
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/writer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Contains high-level interface for an events-based XML emitter.

use std::borrow::Cow;
use std::io::Write;
use std::result::Result as StdResult;

Expand Down Expand Up @@ -143,13 +144,13 @@ impl<W> Writer<W> {
/// # }
/// ```
#[must_use]
pub fn create_element<'a, N>(&'a mut self, name: &'a N) -> ElementWriter<W>
pub fn create_element<'a, N>(&'a mut self, name: N) -> ElementWriter<W>
where
N: 'a + AsRef<str> + ?Sized,
N: Into<Cow<'a, str>>,
{
ElementWriter {
writer: self,
start_tag: BytesStart::new(name.as_ref()),
start_tag: BytesStart::new(name),
}
}
}
Expand Down

0 comments on commit 7e8a003

Please sign in to comment.