pub fn parse_uuid(s: &str, field: &str) -> Result<Uuid, ConnectError>Expand description
Parse a UUID string, returning ConnectError::invalid_argument on failure.
field names the request field being parsed and is included in the error
message to aid API callers in locating the problem (e.g. "org_id").
ยงExample
use api_bones::connect::parse_uuid;
let id = parse_uuid("550e8400-e29b-41d4-a716-446655440000", "org_id").unwrap();
assert_eq!(id.to_string(), "550e8400-e29b-41d4-a716-446655440000");
let err = parse_uuid("not-a-uuid", "org_id").unwrap_err();
// ConnectError message contains the field name