Skip to content

Commit 3946d37

Browse files
authored
impl Iden for String (#1019)
An obvious and often-requested feature. Turns out, now I need this for my other PRs: - #1020 - There's another stacked PR in progress, I'll link it soon
1 parent a3a6a85 commit 3946d37

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/types/iden/core.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ impl Iden for &'static str {
5151
}
5252
}
5353

54+
impl Iden for String {
55+
fn quoted(&self) -> Cow<'static, str> {
56+
Cow::Owned(self.clone())
57+
}
58+
59+
fn unquoted(&self) -> &str {
60+
self
61+
}
62+
}
63+
5464
#[cfg(feature = "thread-safe")]
5565
/// Identifier statically known at compile-time.
5666
pub trait IdenStatic: Iden + Copy + Send + Sync + 'static {
@@ -98,12 +108,6 @@ where
98108
}
99109
}
100110

101-
impl From<String> for DynIden {
102-
fn from(value: String) -> Self {
103-
DynIden(Cow::Owned(value))
104-
}
105-
}
106-
107111
impl<T> From<T> for DynIden
108112
where
109113
T: Iden,

0 commit comments

Comments
 (0)