Skip to content

Commit 92364e9

Browse files
authored
Implement FromStr for Uuid (#561)
1 parent 2c00882 commit 92364e9

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/uuid.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@
135135
#[cfg(test)]
136136
mod test;
137137

138-
use std::fmt::{self, Display};
138+
use std::{
139+
fmt::{self, Display},
140+
str::FromStr,
141+
};
139142

140143
use crate::{
141144
error::{Error, Result},
@@ -210,6 +213,14 @@ impl Default for Uuid {
210213
}
211214
}
212215

216+
impl FromStr for Uuid {
217+
type Err = Error;
218+
219+
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
220+
Self::parse_str(s)
221+
}
222+
}
223+
213224
#[cfg(feature = "uuid-1")]
214225
#[cfg_attr(docsrs, doc(cfg(feature = "uuid-1")))]
215226
impl Uuid {

0 commit comments

Comments
 (0)