diff --git a/src/string.rs b/src/string.rs index 6705cc9..cb7c298 100644 --- a/src/string.rs +++ b/src/string.rs @@ -6,6 +6,7 @@ use core::cmp::Ordering; use core::fmt::{self, Debug, Display, Formatter, Write}; use core::hash::{Hash, Hasher}; use core::ops::{Add, AddAssign, Deref}; +use core::str::FromStr; #[cfg(not(feature = "std"))] use alloc::string::String; @@ -521,6 +522,15 @@ impl From<&EcoString> for String { } } +impl FromStr for EcoString { + type Err = core::convert::Infallible; + + #[inline] + fn from_str(s: &str) -> Result { + Ok(Self::from_str(s)) + } +} + #[cold] const fn exceeded_inline_capacity() -> ! { panic!("exceeded inline capacity");