Skip to content

Commit 63778fc

Browse files
committed
doc: correct return docs for run_optimize function
1 parent eae9d50 commit 63778fc

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

croaring/src/bitmap/imp.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,11 @@ impl Bitmap {
10991099
unsafe { ffi::roaring_bitmap_shrink_to_fit(&mut self.bitmap) }
11001100
}
11011101

1102-
/// Compresses of the bitmap. Returns true if the bitmap was modified.
1102+
/// Optimize the type of containers used in the bitmap.
1103+
///
1104+
/// Returns true if the result contains at least one run container.
1105+
///
1106+
/// Additional space savings may be achieved by calling [`Self::shrink_to_fit`].
11031107
///
11041108
/// # Examples
11051109
///
@@ -1111,6 +1115,8 @@ impl Bitmap {
11111115
/// assert_eq!(bitmap.cardinality(), 900);
11121116
/// let old_size = bitmap.get_serialized_size_in_bytes::<Portable>();
11131117
/// assert!(bitmap.run_optimize());
1118+
/// # // run_optimize returns true if there's at least one run, not if the bitmap was changed
1119+
/// # assert!(bitmap.run_optimize());
11141120
/// let new_size = bitmap.get_serialized_size_in_bytes::<Portable>();
11151121
/// assert!(new_size < old_size);
11161122
/// ```

croaring/src/treemap/imp.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,8 +1158,11 @@ impl Treemap {
11581158
treemap
11591159
}
11601160

1161-
/// Compresses treemap's bitmaps. Returns true if any of the bitmaps
1162-
/// were modified.
1161+
/// Optimize the type of containers used in the treemap.
1162+
///
1163+
/// Returns true if the result contains at least one run container.
1164+
///
1165+
/// Additional space savings may be achieved by calling [`Self::shrink_to_fit`].
11631166
///
11641167
/// # Examples
11651168
///

0 commit comments

Comments
 (0)