summaryrefslogtreecommitdiff
path: root/src/util/eco.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-03 11:44:53 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-03 13:35:39 +0100
commit37a7afddfaffd44cb9bc013c9506599267e08983 (patch)
tree20e7d62d3c5418baff01a21d0406b91bf3096214 /src/util/eco.rs
parent56342bd972a13ffe21beaf2b87ab7eb1597704b4 (diff)
Split crates
Diffstat (limited to 'src/util/eco.rs')
-rw-r--r--src/util/eco.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/util/eco.rs b/src/util/eco.rs
index 645880c4..800760e2 100644
--- a/src/util/eco.rs
+++ b/src/util/eco.rs
@@ -8,7 +8,9 @@ use std::sync::Arc;
use super::ArcExt;
/// Create a new [`EcoString`] from a format string.
-macro_rules! format_eco {
+#[macro_export]
+#[doc(hidden)]
+macro_rules! __format_eco {
($($tts:tt)*) => {{
use std::fmt::Write;
let mut s = $crate::util::EcoString::new();
@@ -17,6 +19,9 @@ macro_rules! format_eco {
}};
}
+#[doc(inline)]
+pub use crate::__format_eco as format_eco;
+
/// An economical string with inline storage and clone-on-write semantics.
#[derive(Clone)]
pub struct EcoString(Repr);
@@ -55,7 +60,7 @@ impl EcoString {
}
/// Create an instance from an existing string-like type.
- pub fn from_str<S>(s: S) -> Self
+ pub fn from_str_like<S>(s: S) -> Self
where
S: AsRef<str> + Into<String>,
{
@@ -324,13 +329,13 @@ impl From<char> for EcoString {
impl From<&str> for EcoString {
fn from(s: &str) -> Self {
- Self::from_str(s)
+ Self::from_str_like(s)
}
}
impl From<String> for EcoString {
fn from(s: String) -> Self {
- Self::from_str(s)
+ Self::from_str_like(s)
}
}