diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-02-23 14:38:37 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-02-23 14:38:45 +0100 |
| commit | affb3534538385056cfb60328f6dba6bd852229a (patch) | |
| tree | a0a1b4844d459a66c3d32e0ad0dacf3f47c3966b /src/model/str.rs | |
| parent | 090831c9cb08c9b3c14ee30b423bb61275d70eb4 (diff) | |
| parent | 457ce954366f3a81989fee788c85a5b20a96ce96 (diff) | |
Merge main back
Diffstat (limited to 'src/model/str.rs')
| -rw-r--r-- | src/model/str.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/model/str.rs b/src/model/str.rs index 8da5b50c..3eee9506 100644 --- a/src/model/str.rs +++ b/src/model/str.rs @@ -3,24 +3,26 @@ use std::fmt::{self, Debug, Display, Formatter, Write}; use std::hash::{Hash, Hasher}; use std::ops::{Add, AddAssign, Deref}; +use ecow::EcoString; use unicode_segmentation::UnicodeSegmentation; use super::{castable, dict, Array, Dict, Value}; use crate::diag::StrResult; use crate::geom::GenAlign; -use crate::util::{format_eco, EcoString}; /// Create a new [`Str`] from a format string. #[macro_export] #[doc(hidden)] macro_rules! __format_str { ($($tts:tt)*) => {{ - $crate::model::Str::from(format_eco!($($tts)*)) + $crate::model::Str::from($crate::model::format_eco!($($tts)*)) }}; } #[doc(inline)] pub use crate::__format_str as format_str; +#[doc(hidden)] +pub use ecow::format_eco; /// An immutable reference counted string. #[derive(Default, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] @@ -415,11 +417,13 @@ impl From<String> for Str { Self(s.into()) } } + impl From<Cow<'_, str>> for Str { fn from(s: Cow<str>) -> Self { Self(s.into()) } } + impl FromIterator<char> for Str { fn from_iter<T: IntoIterator<Item = char>>(iter: T) -> Self { Self(iter.into_iter().collect()) |
