Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ matrix:
- name: "docs"
env: TARGET=x86_64-unknown-linux-gnu
script:
- cargo -vv doc --features nightly,serde,rayon
- cargo -vv doc --features nightly,serde,rayon,raw
- echo '<meta http-equiv=refresh content=0;url=hashbrown/index.html>' > target/doc/index.html
deploy:
provider: pages
Expand Down
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ default = []
nightly = []
rustc-internal-api = []
rustc-dep-of-std = ["nightly", "core", "compiler_builtins", "alloc", "rustc-internal-api"]
raw = []

[package.metadata.docs.rs]
features = ["nightly", "rayon", "serde", "raw"]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ This crate has the following Cargo features:
- `nightly`: Enables nightly-only features: `no_std` support and `#[may_dangle]`.
- `serde`: Enables serde serialization support.
- `rayon`: Enables rayon parallel iterator support.
- `raw`: Enables access to the experimental and unsafe `RawTable` API.

## License

Expand Down
3 changes: 1 addition & 2 deletions src/external_trait_impls/rayon/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
mod helpers;
mod raw;

pub(crate) mod map;
pub(crate) mod raw;
pub(crate) mod set;
19 changes: 18 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,27 @@ doc_comment::doctest!("../README.md");
#[macro_use]
mod macros;

#[cfg(feature = "raw")]
/// Experimental and unsafe `RawTable` API. This module is only available if the
/// `raw` feature is enabled.
pub mod raw {
// The RawTable API is still experimental and is not properly documented yet.
#[allow(missing_docs)]
#[path = "mod.rs"]
mod inner;
pub use inner::*;

#[cfg(feature = "rayon")]
pub mod rayon {
pub use crate::external_trait_impls::rayon::raw::*;
}
}
#[cfg(not(feature = "raw"))]
mod raw;

mod external_trait_impls;
mod fx;
mod map;
mod raw;
#[cfg(feature = "rustc-internal-api")]
mod rustc_entry;
mod scopeguard;
Expand Down
8 changes: 4 additions & 4 deletions src/raw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ impl<T> RawTable<T> {
/// Converts the table into a raw allocation. The contents of the table
/// should be dropped using a `RawIter` before freeing the allocation.
#[inline]
pub fn into_alloc(self) -> Option<(NonNull<u8>, Layout)> {
pub(crate) fn into_alloc(self) -> Option<(NonNull<u8>, Layout)> {
let alloc = if self.is_empty_singleton() {
None
} else {
Expand Down Expand Up @@ -1080,7 +1080,7 @@ impl<T> IntoIterator for RawTable<T> {

/// Iterator over a sub-range of a table. Unlike `RawIter` this iterator does
/// not track an item count.
pub struct RawIterRange<T> {
pub(crate) struct RawIterRange<T> {
// Mask of full buckets in the current group. Bits are cleared from this
// mask as each element is processed.
current_group: BitMask,
Expand Down Expand Up @@ -1124,7 +1124,7 @@ impl<T> RawIterRange<T> {
/// group width.
#[inline]
#[cfg(feature = "rayon")]
pub fn split(mut self) -> (Self, Option<RawIterRange<T>>) {
pub(crate) fn split(mut self) -> (Self, Option<RawIterRange<T>>) {
unsafe {
if self.end <= self.next_ctrl {
// Nothing to split if the group that we are current processing
Expand Down Expand Up @@ -1219,7 +1219,7 @@ impl<T> FusedIterator for RawIterRange<T> {}

/// Iterator which returns a raw pointer to every full bucket in the table.
pub struct RawIter<T> {
pub iter: RawIterRange<T>,
pub(crate) iter: RawIterRange<T>,
items: usize,
}

Expand Down