diff --git a/src/array_string.rs b/src/array_string.rs
index 1aae59e..a94c3f7 100644
--- a/src/array_string.rs
+++ b/src/array_string.rs
@@ -1,13 +1,14 @@
use std::borrow::Borrow;
use std::cmp;
+use std::convert::TryFrom;
use std::fmt;
use std::hash::{Hash, Hasher};
-use std::ptr;
use std::ops::{Deref, DerefMut};
+use std::ptr;
+use std::slice;
use std::str;
use std::str::FromStr;
use std::str::Utf8Error;
-use std::slice;
use crate::array::Array;
use crate::array::Index;
@@ -580,3 +581,16 @@ impl<'de, A> Deserialize<'de> for ArrayString
deserializer.deserialize_str(ArrayStringVisitor::(PhantomData))
}
}
+
+impl<'a, A> TryFrom<&'a str> for ArrayString
+where
+ A: Array- + Copy
+{
+ type Error = CapacityError<&'a str>;
+
+ fn try_from(f: &'a str) -> Result {
+ let mut v = Self::new();
+ v.try_push_str(f)?;
+ Ok(v)
+ }
+}