wrapper_uuid/
wrapper.rs

1use uuid::Uuid;
2
3pub struct WrapperUuid;
4pub trait UuidTrait {
5    fn create() -> String;
6    fn verify(uuid: String) -> Result<bool, String>;
7}
8
9impl UuidTrait for WrapperUuid {
10    fn create() -> String {
11        Uuid::new_v4().to_string()
12    }
13    fn verify(uuid: String) -> Result<bool, String> {
14        match Uuid::parse_str(uuid.as_str()) {
15            Ok(_) => Ok(true),
16            Err(err) => Err(err.to_string()),
17        }
18    }
19}