Skip to content

Commit

Permalink
Turn on warn(missing_docs) and hide some methods from the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemo157 committed Jan 3, 2015
1 parent 36750b6 commit 14f53fb
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 20 deletions.
11 changes: 6 additions & 5 deletions src/imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::{ u16, u32 };
use std::slice;
use std::slice::BinarySearchResult::{ Found, NotFound };

use iter;
use iter::{ Iter, UnionIter, IntersectionIter, DifferenceIter, SymmetricDifferenceIter };
use container::Container;

Expand Down Expand Up @@ -68,7 +69,7 @@ pub fn len(this: &RB) -> uint {

#[inline]
pub fn iter<'a>(this: &'a RB) -> Iter<'a> {
Iter::new(this.containers.iter())
iter::new(this.containers.iter())
}

fn pairs<'a>(this: &'a RB, other: &'a RB) -> Pairs<'a> {
Expand Down Expand Up @@ -96,22 +97,22 @@ pub fn is_superset(this: &RB, other: &RB) -> bool {

#[inline]
pub fn union<'a>(this: &'a RB, other: &'a RB) -> UnionIter<'a> {
UnionIter::new(this.iter(), other.iter())
iter::union::new(this.iter(), other.iter())
}

#[inline]
pub fn intersection<'a>(this: &'a RB, other: &'a RB) -> IntersectionIter<'a> {
IntersectionIter::new(this.iter(), other.iter())
iter::intersection::new(this.iter(), other.iter())
}

#[inline]
pub fn difference<'a>(this: &'a RB, other: &'a RB) -> DifferenceIter<'a> {
DifferenceIter::new(this.iter(), other.iter())
iter::difference::new(this.iter(), other.iter())
}

#[inline]
pub fn symmetric_difference<'a>(this: &'a RB, other: &'a RB) -> SymmetricDifferenceIter<'a> {
SymmetricDifferenceIter::new(this.iter(), other.iter())
iter::symmetric_difference::new(this.iter(), other.iter())
}

#[inline]
Expand Down
43 changes: 28 additions & 15 deletions src/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use util::Either;
use util::Either::{ Left, Right };
use container::{ Container };

/// An iterator for `RoaringBitmap`.
pub struct Iter<'a> {
inner_iter: Option<(u16, Box<Iterator<u16> + 'a>)>,
container_iter: slice::Iter<'a, Container>,
Expand All @@ -20,15 +21,15 @@ fn next_iter<'a>(container_iter: &mut slice::Iter<'a, Container>) -> Option<(u16
container_iter.next().map(|container| (container.key(), container.iter()))
}

impl<'a> Iter<'a> {
#[inline]
pub fn new(mut container_iter: slice::Iter<'a, Container>) -> Iter<'a> {
Iter {
inner_iter: next_iter(&mut container_iter),
container_iter: container_iter
}
#[inline]
pub fn new<'a>(mut container_iter: slice::Iter<'a, Container>) -> Iter<'a> {
Iter {
inner_iter: next_iter(&mut container_iter),
container_iter: container_iter
}
}

impl<'a> Iter<'a> {
#[inline]
fn choose_next(&mut self) -> Option<Either<u32, Option<(u16, Box<Iterator<u16> + 'a>)>>> {
match self.inner_iter {
Expand All @@ -54,16 +55,19 @@ impl<'a> Iterator<u32> for Iter<'a> {
}
}

/// An iterator for `RoaringBitmap`.
pub struct UnionIter<'a> {
current1: Option<u32>,
current2: Option<u32>,
iter1: Iter<'a>,
iter2: Iter<'a>,
}

impl<'a> UnionIter<'a> {
pub mod union {
use super::{ Iter, UnionIter };

#[inline]
pub fn new(mut iter1: Iter<'a>, mut iter2: Iter<'a>) -> UnionIter<'a> {
pub fn new<'a>(mut iter1: Iter<'a>, mut iter2: Iter<'a>) -> UnionIter<'a> {
UnionIter {
current1: iter1.next(),
current2: iter2.next(),
Expand Down Expand Up @@ -91,16 +95,19 @@ impl<'a> Iterator<u32> for UnionIter<'a> {
}
}

/// An iterator for `RoaringBitmap`.
pub struct IntersectionIter<'a> {
current1: Option<u32>,
current2: Option<u32>,
iter1: Iter<'a>,
iter2: Iter<'a>,
}

impl<'a> IntersectionIter<'a> {
pub mod intersection {
use super::{ Iter, IntersectionIter };

#[inline]
pub fn new(mut iter1: Iter<'a>, mut iter2: Iter<'a>) -> IntersectionIter<'a> {
pub fn new<'a>(mut iter1: Iter<'a>, mut iter2: Iter<'a>) -> IntersectionIter<'a> {
IntersectionIter {
current1: iter1.next(),
current2: iter2.next(),
Expand All @@ -126,16 +133,19 @@ impl<'a> Iterator<u32> for IntersectionIter<'a> {
}
}

/// An iterator for `RoaringBitmap`.
pub struct DifferenceIter<'a> {
current1: Option<u32>,
current2: Option<u32>,
iter1: Iter<'a>,
iter2: Iter<'a>,
}

impl<'a> DifferenceIter<'a> {
pub mod difference {
use super::{ Iter, DifferenceIter };

#[inline]
pub fn new(mut iter1: Iter<'a>, mut iter2: Iter<'a>) -> DifferenceIter<'a> {
pub fn new<'a>(mut iter1: Iter<'a>, mut iter2: Iter<'a>) -> DifferenceIter<'a> {
DifferenceIter {
current1: iter1.next(),
current2: iter2.next(),
Expand All @@ -162,16 +172,19 @@ impl<'a> Iterator<u32> for DifferenceIter<'a> {
}
}

/// An iterator for `RoaringBitmap`.
pub struct SymmetricDifferenceIter<'a> {
current1: Option<u32>,
current2: Option<u32>,
iter1: Iter<'a>,
iter2: Iter<'a>,
}

impl<'a> SymmetricDifferenceIter<'a> {
pub mod symmetric_difference {
use super::{ Iter, SymmetricDifferenceIter };

#[inline]
pub fn new(mut iter1: Iter<'a>, mut iter2: Iter<'a>) -> SymmetricDifferenceIter<'a> {
pub fn new<'a>(mut iter1: Iter<'a>, mut iter2: Iter<'a>) -> SymmetricDifferenceIter<'a> {
SymmetricDifferenceIter {
current1: iter1.next(),
current2: iter2.next(),
Expand Down
11 changes: 11 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
//! This is a [Rust][] port of the [Roaring bitmap][] data structure, initially
//! defined as a [Java library][roaring-java] and described in [_Better bitmap
//! performance with Roaring bitmaps_][roaring-paper].
//!
//! [Rust]: https://rust-lang.org
//! [Roaring bitmap]: http://roaringbitmap.org
//! [roaring-java]: https://github.com/lemire/RoaringBitmap
//! [roaring-paper]: http://arxiv.org/pdf/1402.6407v4
#![feature(slicing_syntax)]
#![feature(advanced_slice_patterns)]

#![warn(missing_docs)]

use std::fmt::{ Show, Formatter, Result };

pub use iter::{ Iter, UnionIter, IntersectionIter, DifferenceIter, SymmetricDifferenceIter };
Expand Down

0 comments on commit 14f53fb

Please sign in to comment.