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

feat: impl From<[(K, V); N]> for Map and Value #938

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

paul-soporan
Copy link

This PR implements From<[(K, V); N]> for Map and Value, enabling things like:

let map = Map::from([("lorem", 40), ("ipsum", 2)]);

or

let v = [("lorem", 40), ("ipsum", 2)];
let x: Value = v.into();

Relevant PRs:

Copy link

@martin-g martin-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR does not have any unit tests.

@paul-soporan
Copy link
Author

I'm new to writing tests in Rust so I apologize if the answer is obvious:

From what I could find, it seems like this crate doesn't have any existing unit tests, but only integration tests and documentation tests.

The example I added to From<[(K, V); N]> for Value is already checked as a doc test, and I could add a doc test to the impl for Map too. Is there any advantage to writing unit tests instead (especially when all other From impls are only checked via doctests)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants