File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " smol_str"
3
- version = " 0.1.18 "
3
+ version = " 0.1.19 "
4
4
description = " small-string optimized string type with O(1) clone"
5
5
license = " MIT OR Apache-2.0"
6
6
repository = " https://github.com/matklad/smol_str"
Original file line number Diff line number Diff line change @@ -6,11 +6,13 @@ extern crate core as std;
6
6
#[ cfg( not( feature = "std" ) ) ]
7
7
extern crate alloc;
8
8
9
+ use core:: convert:: Infallible ;
9
10
use std:: {
10
11
borrow:: Borrow ,
11
12
cmp:: { self , Ordering } ,
12
13
fmt, hash, iter,
13
14
ops:: Deref ,
15
+ str:: FromStr ,
14
16
} ;
15
17
16
18
#[ cfg( not( feature = "std" ) ) ]
@@ -316,6 +318,15 @@ impl Borrow<str> for SmolStr {
316
318
}
317
319
}
318
320
321
+ impl FromStr for SmolStr {
322
+ type Err = Infallible ;
323
+
324
+ #[ inline]
325
+ fn from_str ( s : & str ) -> Result < SmolStr , Self :: Err > {
326
+ Ok ( SmolStr :: from ( s) )
327
+ }
328
+ }
329
+
319
330
#[ cfg( feature = "arbitrary" ) ]
320
331
impl < ' a > arbitrary:: Arbitrary < ' a > for SmolStr {
321
332
fn arbitrary ( u : & mut arbitrary:: Unstructured < ' a > ) -> Result < Self , arbitrary:: Error > {
You can’t perform that action at this time.
0 commit comments