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: publicly export UniqueIter #87

Merged
merged 1 commit into from
Sep 27, 2023
Merged

feat: publicly export UniqueIter #87

merged 1 commit into from
Sep 27, 2023

Conversation

hawkw
Copy link
Owner

@hawkw hawkw commented Sep 27, 2023

This type is returned by a public method, but it isn't publicly re-exported. This means that it cannot currently be named in downstream code, and the documentation for its Iterator implementation is not rendered in RustDoc. This is an oversight on my part, as the type was intended to be public.

This commit fixes that, by publicly re-exporting UniqueIter. In addition, I've added some improved documentation for UniqueIter, which should help users to understand its guarantees.

Fixes #77

This type is returned by a public method, but it isn't publicly
re-exported. This means that it cannot currently be named in downstream
code, and the documentation for its `Iterator` implementation is not
rendered in RustDoc. This is an oversight on my part, as the type was
intended to be public.

This commit fixes that, by publicly re-exporting `UniqueIter`. In
addition, I've added some improved documentation for `UniqueIter`, which
should help users to understand its guarantees.

Fixes #77
@hawkw hawkw enabled auto-merge (squash) September 27, 2023 21:15
@hawkw hawkw merged commit e4d6482 into main Sep 27, 2023
Copy link

@jplatte jplatte left a comment

Choose a reason for hiding this comment

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

Yeah, this would have helped me when reading the docs :)

Not sure if it will produce some false-positives¹ for you, but the unreachable_pub lint would have caught that this type with pub visibility is not nameable by crate users.

¹ I don't personally like that it triggers on pub fields on pub(crate) types

@@ -735,6 +738,10 @@ impl<T, C: cfg::Config> Slab<T, C> {
}

/// Returns an iterator over all the items in the slab.
///
/// Because this iterator exclusively borrows the slab (i.e. it holds an
/// `&mut Slab<T>`), elements will not be added or removed while the
Copy link

Choose a reason for hiding this comment

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

Suggested change
/// `&mut Slab<T>`), elements will not be added or removed while the
/// `&mut Slab<T>`), elements can not be added or removed while the

hawkw added a commit that referenced this pull request Sep 27, 2023
#### Features

*   publicly export `UniqueIter` (#87)
    ([e4d6482](e4d6482),
    closes [#77](#77))

#### Bug Fixes

*   use a smaller `CustomConfig` for 32-bit tests (#84)
    ([828ffff](828ffff),
    closes [#82](#82))
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.

Document semantics of Slab::unique_iter
2 participants