diff --git a/src/attribute.rs b/src/attribute.rs
index dd5ffb78..081c5311 100644
--- a/src/attribute.rs
+++ b/src/attribute.rs
@@ -37,7 +37,7 @@ impl<'a> Attribute<'a> {
/// Creates a borrowed attribute using the provided borrowed name and a borrowed string value.
#[inline]
#[must_use]
- pub fn new(name: Name<'a>, value: &'a str) -> Attribute<'a> {
+ pub const fn new(name: Name<'a>, value: &'a str) -> Self {
Attribute { name, value }
}
}
diff --git a/src/macros.rs b/src/macros.rs
index 25bf97ca..8298e215 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -21,7 +21,7 @@ macro_rules! gen_setter {
/// See [`ParserConfig`][crate::ParserConfig] fields docs for details
#[inline]
#[must_use]
- pub fn $field(mut self, value: $t) -> Self {
+ pub const fn $field(mut self, value: $t) -> Self {
self.$field = value;
self
}
@@ -32,7 +32,7 @@ macro_rules! gen_setter {
/// See [`ParserConfig`][crate::ParserConfig] fields docs for details
#[inline]
#[must_use]
- pub fn $field(mut self, value: $t) -> Self {
+ pub const fn $field(mut self, value: $t) -> Self {
self.c.$field = value;
self
}
diff --git a/src/name.rs b/src/name.rs
index 5a0be587..c3075046 100644
--- a/src/name.rs
+++ b/src/name.rs
@@ -99,7 +99,7 @@ impl<'a> Name<'a> {
/// Returns a new `Name` instance representing plain local name.
#[inline]
#[must_use]
- pub fn local(local_name: &str) -> Name<'_> {
+ pub const fn local(local_name: &str) -> Name<'_> {
Name {
local_name,
prefix: None,
@@ -110,7 +110,7 @@ impl<'a> Name<'a> {
/// Returns a new `Name` instance with the given local name and prefix.
#[inline]
#[must_use]
- pub fn prefixed(local_name: &'a str, prefix: &'a str) -> Name<'a> {
+ pub const fn prefixed(local_name: &'a str, prefix: &'a str) -> Self {
Name {
local_name,
namespace: None,
@@ -122,7 +122,7 @@ impl<'a> Name<'a> {
/// with a namespace URI.
#[inline]
#[must_use]
- pub fn qualified(local_name: &'a str, namespace: &'a str, prefix: Option<&'a str>) -> Name<'a> {
+ pub const fn qualified(local_name: &'a str, namespace: &'a str, prefix: Option<&'a str>) -> Self {
Name {
local_name,
namespace: Some(namespace),
@@ -146,7 +146,7 @@ impl<'a> Name<'a> {
/// allocations.
#[inline]
#[must_use]
- pub fn repr_display(&self) -> ReprDisplay<'_, '_> {
+ pub const fn repr_display(&self) -> ReprDisplay<'_, '_> {
ReprDisplay(self)
}
diff --git a/src/writer/events.rs b/src/writer/events.rs
index cc087047..59fac09f 100644
--- a/src/writer/events.rs
+++ b/src/writer/events.rs
@@ -97,7 +97,7 @@ impl<'a> XmlEvent<'a> {
/// Returns an writer event for a processing instruction.
#[inline]
#[must_use]
- pub fn processing_instruction(name: &'a str, data: Option<&'a str>) -> XmlEvent<'a> {
+ pub const fn processing_instruction(name: &'a str, data: Option<&'a str>) -> Self {
XmlEvent::ProcessingInstruction { name, data }
}
@@ -121,7 +121,7 @@ impl<'a> XmlEvent<'a> {
/// is disabled, it is possible to specify the name with `name()` method on the builder.
#[inline]
#[must_use]
- pub fn end_element() -> EndElementBuilder<'a> {
+ pub const fn end_element() -> EndElementBuilder<'a> {
EndElementBuilder { name: None }
}
@@ -131,7 +131,7 @@ impl<'a> XmlEvent<'a> {
/// (depending on the configuration).
#[inline]
#[must_use]
- pub fn cdata(data: &'a str) -> XmlEvent<'a> {
+ pub const fn cdata(data: &'a str) -> Self {
XmlEvent::CData(data)
}
@@ -140,14 +140,14 @@ impl<'a> XmlEvent<'a> {
/// All offending symbols, in particular, `&` and `<`, will be escaped by the writer.
#[inline]
#[must_use]
- pub fn characters(data: &'a str) -> XmlEvent<'a> {
+ pub const fn characters(data: &'a str) -> Self {
XmlEvent::Characters(data)
}
/// Returns a comment event.
#[inline]
#[must_use]
- pub fn comment(data: &'a str) -> XmlEvent<'a> {
+ pub const fn comment(data: &'a str) -> Self {
XmlEvent::Comment(data)
}
}