Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RUST-1508 Implement conversion traits between strings and ObjectId #376

Open
clarkmcc opened this issue Oct 10, 2022 · 0 comments
Open

RUST-1508 Implement conversion traits between strings and ObjectId #376

clarkmcc opened this issue Oct 10, 2022 · 0 comments
Assignees
Labels
tracked-in-jira Ticket filed in Mongo's Jira system

Comments

@clarkmcc
Copy link

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.

@bajanam bajanam removed the triage label Oct 11, 2022
@bajanam bajanam added the tracked-in-jira Ticket filed in Mongo's Jira system label Nov 1, 2022
@bajanam bajanam changed the title Implement conversion traits between strings and ObjectId RUST-1508 Implement conversion traits between strings and ObjectId Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tracked-in-jira Ticket filed in Mongo's Jira system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants