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

fix: export RawElement type #461

Merged
merged 5 commits into from
Mar 4, 2024
Merged

Conversation

tychoish
Copy link
Contributor

Missed that exports had to be explicitly re-exported in #449.

@tychoish
Copy link
Contributor Author

tychoish commented Mar 1, 2024

@abr-egn, I found this when trying to use this in addition to #462. I missed that the exports of symbols here needed to be explicit, so while you can use this, if you want to pass the iterator around explicitly, you can't because the symbol isn't exported.

@abr-egn
Copy link
Contributor

abr-egn commented Mar 1, 2024

Yup :) Isabel's taking a look at this.

Copy link
Contributor

@isabelatkinson isabelatkinson left a comment

Choose a reason for hiding this comment

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

Just one minor request, going to tag in @abr-egn as well. On an unrelated note, it doesn't seem like our documentation lint task is catching that there's missing documentation for this type and its methods. I filed RUST-1868 to fix this.

src/raw/iter.rs Outdated
@@ -145,6 +145,10 @@ impl<'a> TryInto<Bson> for RawElement<'a> {
}

impl<'a> RawElement<'a> {
pub fn is_empty(&self) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for catching this clippy error! I think it would make more sense to call the len method size since it's exposing the number of bytes in the element. That would remove the need to have this is_empty method, which likely won't have any utility for the users of this type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm fine with that if you are. I think it is technically API breaking because you could have called the len() method before even though the type wasn't exported.

I don't care, but you might.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh that's a great point, in that case I think we'll want to stick to len for the name and change it with the next major release (RUST-1869). I still don't think it makes that much sense to have an is_empty method, so I suggest silencing the clippy error with #[allow(clippy::len_without_is_empty)]. Sorry for all of the back-and-forth here!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

@isabelatkinson isabelatkinson requested a review from abr-egn March 1, 2024 19:21
@tychoish tychoish requested a review from isabelatkinson March 1, 2024 22:17
tychoish added 2 commits March 1, 2024 18:16
This reverts commit 747a7ef.
Copy link
Contributor

@abr-egn abr-egn left a comment

Choose a reason for hiding this comment

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

LGTM!

@abr-egn abr-egn merged commit 5890071 into mongodb:main Mar 4, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants