If you want the function to accept values of Uuid as well, you could make an enum and take that:
enum Value<'a> {
Str(&'a str),
Uuid(Uuid),
}
pub fn exists<'a>(value: Value<'a>) -> bool {
let conn = db::pg_connection();
match value {
Str(s) => ... // s is a &str
Uuid(u) => ... // uuid is a Uuid
}
}
You could also implement From<&str> and From<Uuid> for Value, then make exists take a generic V: Into<Value>, so that you can call exists directly with either a &str or Uuid. It really depends on how you're calling this exists function, though.