I'd like to be able to do things like
fn query<K: TryInto<ObjectId>>(key: K) {}
fn main() {
let key = "000000000000000000000000";
query(key);
let key = String::from("000000000000000000000000");
query(key);
let key = ObjectId::new();
query(key);
}
but it doesn't seem like the necessary conversion traits have been implemented. I'm not a Rust expert and so I cannot speak to what the solution is, but it would be really convenient to be able to both pass ObjectIds and types that can be turned into ObjectIds.
I'd like to be able to do things like
but it doesn't seem like the necessary conversion traits have been implemented. I'm not a Rust expert and so I cannot speak to what the solution is, but it would be really convenient to be able to both pass ObjectIds and types that can be turned into ObjectIds.