Class: Roaring::Bitmap

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
ext/roaring/src/lib.rs,
lib/roaring.rb

Overview

Roaring::Bitmap is a fast, compressed bitmap implementation.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

._load(args) ⇒ Object



58
59
60
# File 'lib/roaring.rb', line 58

def self._load(args)
  deserialize(args)
end

.deserialize(rstr) ⇒ Roaring::Bitmap

Deserializes a bitmap from its binary representation.

Examples:

Deserializing a bitmap.

rb = Roaring::Bitmap.new
rb.insert_many([1, 2, 3])
dumped = rb.serialize   #=> ":0\..."

from_binary = Roaring::Bitmap.deserialize(dumped)
rb.eql?(from_binary)    #=> true

Parameters:

  • rstr (String)

    The binary representation of the bitmap.

Returns:



711
712
713
714
715
716
# File 'ext/roaring/src/lib.rs', line 711

fn deserialize(rstr: RString) -> Result<Self, Error> {
        let buf = unsafe { rstr.as_slice() };
        let d = RoaringBitmap::deserialize_from(&mut &buf[..]).unwrap();
        Ok(Self(RefCell::new(Wrapper { _data: d })))
    }
}

.from_a(array) ⇒ Roaring::Bitmap

Initializes a new bitmap from an array of integers.

Examples:

Initialize a bitmap from an array of integers

rb = Roaring::Bitmap.from_a([1, 2, 3])
rb.to_a     #=> [1, 2, 3]

Parameters:

  • array (Array<Integer>)

    An array of integers to initialize the bitmap.

Returns:



71
72
73
74
75
76
# File 'ext/roaring/src/lib.rs', line 71

fn from_array(array: RArray) -> Self {
    let values = array.to_vec::<u32>().unwrap();
    Self(RefCell::new(Wrapper {
        _data: RoaringBitmap::from_iter(values),
    }))
}

.fullRoaring::Bitmap

Initializes a new bitmap with all bits set to 1.

Examples:

Initialize a full bitmap.

rb = Roaring::Bitmap.full
rb.full?    #=> true

Returns:



53
54
55
56
57
# File 'ext/roaring/src/lib.rs', line 53

fn new_full() -> Self {
    Self(RefCell::new(Wrapper {
        _data: RoaringBitmap::full(),
    }))
}

.newRoaring::Bitmap

Initializes a new empty bitmap.

Returns:



37
38
39
40
41
# File 'ext/roaring/src/lib.rs', line 37

fn new() -> Self {
    Self(RefCell::new(Wrapper {
        _data: RoaringBitmap::new(),
    }))
}

Instance Method Details

#_dump(_level) ⇒ Object



62
63
64
# File 'lib/roaring.rb', line 62

def _dump(_level)
  serialize
end

#byte_sizeInteger

Returns the size of the bitmap in bytes.

Examples:

Computing the size of a bitmap in bytes.

rb = Roaring::Bitmap.new
rb.insert_many([1, 2, 3, 4, 5])
rb.byte_size #=> 26

Returns:

  • (Integer)

    The size of the bitmap in bytes.



655
656
657
# File 'ext/roaring/src/lib.rs', line 655

fn byte_size(&self) -> Result<usize, Error> {
    Ok(self.0.borrow()._data.serialized_size())
}

#cardinalityInteger Also known as: size, count, length

Returns the number of items in the bitmap.

Examples:

Return the number of items in the bitmap.

rb = Roaring::Bitmap.new
rb.insert_many([1, 2, 3])
rb.cardinality  #=> 3

Returns:

  • (Integer)

    The number of items in the bitmap.



210
211
212
# File 'ext/roaring/src/lib.rs', line 210

fn len(&self) -> Result<u64, Error> {
    Ok(self.0.borrow()._data.len())
}

#clearnil Also known as: reset

Clears the bitmap, removing all items.

Examples:

Clear the bitmap.

rb = Roaring::Bitmap.new
rb.insert_many([1, 2, 3])
rb.to_a     #=> [1, 2, 3]
rb.clear
rb.to_a     #=> []

Returns:

  • (nil)


194
195
196
197
# File 'ext/roaring/src/lib.rs', line 194

fn clear(&self) -> Result<(), Error> {
    self.0.borrow_mut()._data.clear();
    Ok(())
}

#contains(item) ⇒ Boolean Also known as: include?, member?, contains?

Check the bitmap for the presence of an item.

Examples:

Check the bitmap for the presence of an item.

rb = Roaring::Bitmap.new
rb.insert(1)
rb.contains(1)  #=> true

Check the bitmap for the presence of an item that is not present.

rb = Roaring::Bitmap.new
rb.contains(1)  #=> false

Parameters:

  • item (Integer)

    The item to check for.

Returns:

  • (Boolean)

    true if the item is present, false otherwise.



162
163
164
# File 'ext/roaring/src/lib.rs', line 162

fn contains(&self, item: u32) -> Result<bool, Error> {
    Ok(self.0.borrow()._data.contains(item))
}

#difference(other) ⇒ Roaring::Bitmap Also known as: -, and_not

A difference between the two bitmaps. Bitwise AND NOT.

Examples:

Computing the difference of two bitmaps.

rb1 = Roaring::Bitmap.new
rb1.insert_many([1, 2, 3])
rb2 = Roaring::Bitmap.new
rb2.insert_many([3, 4, 5])
rb1.difference(rb2).to_a    #=> [1, 2]
rb1.and_not(rb2).to_a       #=> [1, 2]
(rb1 - rb2).to_a            #=> [1, 2]

Parameters:

  • other (Roaring::Bitmap)

    The other bitmap to compute the difference with.

Returns:



498
499
500
501
502
503
504
# File 'ext/roaring/src/lib.rs', line 498

fn difference(&self, other: &Self) -> Result<Self, Error> {
    let lhs = &self.0.borrow()._data;
    let rhs = &other.0.borrow()._data;
    let d = lhs.sub(rhs);

    Ok(Self(RefCell::new(Wrapper { _data: d })))
}

#difference_len(other) ⇒ Integer Also known as: and_not_len

Computes the difference of the bitmap with another bitmap and returns the cardinality of the result. Useful for when you want to know the length of the result but not create a new bitmap.

Examples:

Computing the difference length of two bitmaps.

rb1 = Roaring::Bitmap.new
rb1.insert_many([1, 2, 3])
rb2 = Roaring::Bitmap.new
rb2.insert_many([3, 4, 5])
rb1.difference_len(rb2)     #=> 2

Parameters:

  • other (Roaring::Bitmap)

    The other bitmap to compute the difference length with.

Returns:

  • (Integer)

    The cardinality of the difference of the bitmap with another bitmap.



522
523
524
525
526
527
528
# File 'ext/roaring/src/lib.rs', line 522

fn difference_len(&self, other: &Self) -> Result<u64, Error> {
    Ok(self
        .0
        .borrow()
        ._data
        .difference_len(&other.0.borrow()._data))
}

#disjoint?(other) ⇒ Boolean

Checks if the bitmaps are disjoint.

Examples:

When the bitmaps are disjoint.

rb1 = Roaring::Bitmap.new
rb1.insert_many([1, 2, 3])
rb2 = Roaring::Bitmap.new
rb2.insert_many([4, 5, 6])
rb1.disjoint?(rb2)  #=> true

When the bitmaps are not disjoint.

rb1 = Roaring::Bitmap.new
rb1.insert_many([1, 2, 3])
rb2 = Roaring::Bitmap.new
rb2.insert_many([3, 4, 5])
rb1.disjoint?(rb2)  #=> false

Parameters:

Returns:

  • (Boolean)

    true if the bitmaps are disjoint, false otherwise.



331
332
333
# File 'ext/roaring/src/lib.rs', line 331

fn is_disjoint(&self, other: &Self) -> Result<bool, Error> {
    Ok(self.0.borrow()._data.is_disjoint(&other.0.borrow()._data))
}

#each {|Integer| ... } ⇒ Roaring::Bitmap #eachEnumerator

Overloads:

  • #each {|Integer| ... } ⇒ Roaring::Bitmap

    Iterates over the bitmap and yields each item.

    Examples:

    Iterating over a bitmap.

    rb = Roaring::Bitmap.new
    rb.insert_many([1, 2, 3, 4, 5])
    rb.each do |i|
        puts i
    end

    Yields:

    • (Integer)

      The item in the bitmap.

    Returns:

  • #eachEnumerator

    Returns an enumerator if no block is given.

    Examples:

    Receiving an Enumerator if no block is given.

    rb = Roaring::Bitmap.new
    rb.insert_many([1, 2, 3, 4, 5])
    rb.each #=> #<Enumerator: ...>

    Returns:

    • (Enumerator)

      An enumerator.



622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
# File 'ext/roaring/src/lib.rs', line 622

fn each(rb_self: Obj<Self>) -> Result<Value, Error> {
    if block_given() {
        let self_struct = rb_self.get();
        let data = &self_struct.0.borrow()._data;
        let block = block_proc().unwrap();
        for i in data.iter() {
            let rparams = RArray::with_capacity(1);
            rparams.push(i).unwrap();
            match block.call::<RArray, Option<Value>>(rparams) {
                Ok(_) => {}
                Err(e) => {
                    return Err(e);
                }
            }
        }

        Ok(*rb_self)
    } else {
        Ok(*rb_self.enumeratorize("each", ()))
    }
}

#empty?Boolean

Checks if the bitmap is empty.

Examples:

Checking an empty bitmap.

rb = Roaring::Bitmap.new
rb.empty?   #=> true

Checking a non-empty bitmap.

rb = Roaring::Bitmap.new
rb.insert(1)
rb.empty?   #=> false

Returns:

  • (Boolean)

    true if the bitmap is empty, false otherwise.



229
230
231
# File 'ext/roaring/src/lib.rs', line 229

fn is_empty(&self) -> Result<bool, Error> {
    Ok(self.0.borrow()._data.is_empty())
}

#eql?(other) ⇒ Boolean Also known as: ==

Checks if the bitmap is equal to another bitmap.

Examples:

Checking if two bitmaps are equal.

rb1 = Roaring::Bitmap.new
rb1.insert_many([1, 2, 3])
rb2 = Roaring::Bitmap.new
rb2.insert_many([1, 2, 3])
rb1.eql?(rb2) #=> true

Parameters:

Returns:

  • (Boolean)

    True if the bitmap is equal to another bitmap, false otherwise.



674
675
676
# File 'ext/roaring/src/lib.rs', line 674

fn eql(&self, other: &Self) -> Result<bool, Error> {
    Ok(self.0.borrow()._data == other.0.borrow()._data)
}

#full?Boolean

Checks if the bitmap is full.

Examples:

Checking a full bitmap.

rb = Roaring::Bitmap.full
rb.full?    #=> true

Checking a non-full bitmap.

rb = Roaring::Bitmap.new
rb.insert(1)
rb.full?    #=> false

Returns:

  • (Boolean)

    true if the bitmap is full, false otherwise.



248
249
250
# File 'ext/roaring/src/lib.rs', line 248

fn is_full(&self) -> Result<bool, Error> {
    Ok(self.0.borrow()._data.is_full())
}

#hashObject



54
55
56
# File 'lib/roaring.rb', line 54

def hash
  to_a.hash
end

#insert(item) ⇒ Boolean Also known as: <<

Inserts an item into the bitmap.

Examples:

Insert an item into the bitmap.

rb = Roaring::Bitmap.new
rb.insert(1)    #=> true

Insert an item that is already present into the bitmap.

rb = Roaring::Bitmap.new
rb.insert(1)    #=> true
rb.insert(1)    #=> false

Parameters:

  • item (Integer)

    The item to insert.

Returns:

  • (Boolean)

    true if the item was not already present, false otherwise.



95
96
97
# File 'ext/roaring/src/lib.rs', line 95

fn insert(&self, item: u32) -> Result<bool, Error> {
    Ok(self.0.borrow_mut()._data.insert(item))
}

#insert_many(items) ⇒ Integer

Inserts multiple items into the bitmap.

Examples:

Insert multiple items into the bitmap.

rb = Roaring::Bitmap.new
rb.insert_many([1, 2, 3])   #=> 3
rb.to_a                     #=> [1, 2, 3]

Parameters:

  • items (Array<Integer>)

    An array of items to insert.

Returns:

  • (Integer)

    The number of items that were inserted.



112
113
114
115
116
117
118
119
120
121
122
# File 'ext/roaring/src/lib.rs', line 112

fn insert_many(&self, items: RArray) -> Result<u32, Error> {
    let values = items.to_vec::<u32>()?;
    let mut inserted = 0;
    for value in values {
        if self.0.borrow_mut()._data.insert(value) {
            inserted += 1;
        }
    }

    Ok(inserted)
}

#intersection(other) ⇒ Roaring::Bitmap Also known as: &, and

Intersects the bitmap with another bitmap. Bitwise AND.

Examples:

Intersecting two bitmaps.

rb1 = Roaring::Bitmap.new
rb1.insert_many([1, 2, 3])
rb2 = Roaring::Bitmap.new
rb2.insert_many([3, 4, 5])
rb1.intersection(rb2).to_a #=> [3]
rb1.and(rb2).to_a          #=> [3]
(rb1 & rb2).to_a           #=> [3]

Parameters:

Returns:

  • (Roaring::Bitmap)

    The intersection of the bitmap with another bitmap.



449
450
451
452
453
454
455
# File 'ext/roaring/src/lib.rs', line 449

fn intersection(&self, other: &Self) -> Result<Self, Error> {
    let lhs = &self.0.borrow()._data;
    let rhs = &other.0.borrow()._data;
    let d = lhs.bitand(rhs);

    Ok(Self(RefCell::new(Wrapper { _data: d })))
}

#intersection_len(other) ⇒ Integer Also known as: and_len

Computes the intersection of the bitmap with another bitmap and returns the cardinality of the result. Useful for when you want to know the length of the result but not create a new bitmap.

Examples:

Computing the intersection length of two bitmaps.

rb1 = Roaring::Bitmap.new
rb1.insert_many([1, 2, 3])
rb2 = Roaring::Bitmap.new
rb2.insert_many([3, 4, 5])
rb1.intersection_len(rb2)   #=> 1

Parameters:

  • other (Roaring::Bitmap)

    The other bitmap compute the intersection length with.

Returns:

  • (Integer)

    The cardinality of the intersection of the bitmap with another bitmap.



473
474
475
476
477
478
479
# File 'ext/roaring/src/lib.rs', line 473

fn intersection_len(&self, other: &Self) -> Result<u64, Error> {
    Ok(self
        .0
        .borrow()
        ._data
        .intersection_len(&other.0.borrow()._data))
}

#maxInteger? Also known as: last

Retrieves the maximum value in the bitmap.

Examples:

Retrieving the maximum value in the bitmap.

rb = Roaring::Bitmap.new
rb.insert_many([1, 2, 3])
rb.max  #=> 3

Retrieving the maximum value in an empty bitmap.

rb = Roaring::Bitmap.new
rb.max  #=> nil

Returns:

  • (Integer, nil)

    The maximum value in the bitmap, or nil if the bitmap is empty.



267
268
269
# File 'ext/roaring/src/lib.rs', line 267

fn max(&self) -> Result<Option<u32>, Error> {
    Ok(self.0.borrow()._data.max())
}

#minInteger? Also known as: first

Retrieves the minimum value in the bitmap.

Examples:

Retrieving the minimum value in the bitmap.

rb = Roaring::Bitmap.new
rb.insert_many([1, 2, 3])
rb.min  #=> 1

Retrieving the minimum value in an empty bitmap.

rb = Roaring::Bitmap.new
rb.min  #=> nil

Returns:

  • (Integer, nil)

    The minimum value in the bitmap, or nil if the bitmap is empty.



286
287
288
# File 'ext/roaring/src/lib.rs', line 286

fn min(&self) -> Result<Option<u32>, Error> {
    Ok(self.0.borrow()._data.min())
}

#nth(item) ⇒ Integer?

Retrieves the nth integer in the bitmap, or nil if the bitmap is empty or if n is out of bounds.

Examples:

Retrieving the nth integer in the bitmap.

rb = Roaring::Bitmap.new
rb.insert_many([1, 2, 3])
rb.nth(1)   #=> 2

Retrieving the nth integer in an empty bitmap.

rb = Roaring::Bitmap.new
rb.nth(1)   #=> nil

Returns:

  • (Integer, nil)

    The nth integer in the bitmap, or nil if the bitmap is empty or if n is out of bounds.



305
306
307
# File 'ext/roaring/src/lib.rs', line 305

fn select(&self, item: u32) -> Result<Option<u32>, Error> {
    Ok(self.0.borrow()._data.select(item))
}

#rank(item) ⇒ Integer

Returns the number of integers that are <= value. rank(u32::MAX) == len(). This is also known as the rank or rank-select idiom.

Examples:

Computing the rank of an item in a bitmap.

rb = Roaring::Bitmap.new
rb.insert_many([1, 2, 3, 4, 5])
rb.rank(3) #=> 3

Returns:

  • (Integer)

    The number of integers that are <= value.

Raises:



591
592
593
# File 'ext/roaring/src/lib.rs', line 591

fn rank(&self, item: u32) -> Result<u64, Error> {
    Ok(self.0.borrow()._data.rank(item))
}

#remove(item) ⇒ Boolean Also known as: delete

Removes an item from the bitmap.

Examples:

Remove an item from the bitmap.

rb = Roaring::Bitmap.new
rb.insert(1)
rb.remove(1)    #=> true

Remove an item that is not present in the bitmap.

rb = Roaring::Bitmap.new
rb.remove(1)    #=> false

Parameters:

  • item (Integer)

    The item to remove.

Returns:

  • (Boolean)

    true if the item was present, false otherwise.



141
142
143
# File 'ext/roaring/src/lib.rs', line 141

fn remove(&self, item: u32) -> Result<bool, Error> {
    Ok(self.0.borrow_mut()._data.remove(item))
}

#serializeString

Serializes the bitmap into its binary representation.

Examples:

Serializing a bitmap.

rb = Roaring::Bitmap.new
rb.insert_many([1, 2, 3])
rb.serialize    #=> ":0\x00\x00\x01\x00\x00\x00\x00\x00\x04\x00\x10\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00"

Returns:

  • (String)

    The binary representation of the bitmap.



689
690
691
692
693
# File 'ext/roaring/src/lib.rs', line 689

fn serialize(&self) -> Result<RString, Error> {
    let mut buf = vec![];
    self.0.borrow()._data.serialize_into(&mut buf).unwrap();
    Ok(RString::from_slice(&buf))
}

#subset?(other) ⇒ Boolean

Checks if the bitmap is a subset of another bitmap.

Examples:

When the bitmap is a subset of another bitmap.

rb1 = Roaring::Bitmap.new
rb1.insert_many([1, 2, 3])
rb2 = Roaring::Bitmap.new
rb2.insert_many([1, 2, 3, 4, 5])
rb1.subset?(rb2)    #=> true

When the bitmap is not a subset of another bitmap.

rb1 = Roaring::Bitmap.new
rb1.insert_many([1, 2, 3])
rb2 = Roaring::Bitmap.new
rb2.insert_many([3, 4, 5])
rb1.subset?(rb2)    #=> false

Parameters:

Returns:

  • (Boolean)

    true if the bitmap is a subset of another bitmap, false otherwise.



357
358
359
# File 'ext/roaring/src/lib.rs', line 357

fn is_subset(&self, other: &Self) -> Result<bool, Error> {
    Ok(self.0.borrow()._data.is_subset(&other.0.borrow()._data))
}

#superset?(other) ⇒ Boolean

Checks if the bitmap is a superset of another bitmap.

Examples:

When the bitmap is a superset of the other bitmap.

rb1 = Roaring::Bitmap.new
rb1.insert_many([1, 2, 3, 4, 5])
rb2 = Roaring::Bitmap.new
rb2.insert_many([1, 2, 3])
rb1.superset?(rb2)  #=> true

When the bitmap is not a superset of the other bitmap.

rb1 = Roaring::Bitmap.new
rb1.insert_many([3, 4, 5])
rb2 = Roaring::Bitmap.new
rb2.insert_many([1, 2, 3])
rb1.superset?(rb2)  #=> false

Parameters:

Returns:

  • (Boolean)

    true if the bitmap is a superset of another bitmap, false otherwise.



383
384
385
# File 'ext/roaring/src/lib.rs', line 383

fn is_superset(&self, other: &Self) -> Result<bool, Error> {
    Ok(self.0.borrow()._data.is_superset(&other.0.borrow()._data))
}

#symmetric_difference(other) ⇒ Roaring::Bitmap Also known as: ^, xor

A symmetric difference between the two bitmaps. This is equivalent to the union of the two bitmaps minus the intersection. Bitwise XOR.

Examples:

Computing the symmetric difference of two bitmaps.

rb1 = Roaring::Bitmap.new
rb1.insert_many([1, 2, 3])
rb2 = Roaring::Bitmap.new
rb2.insert_many([3, 4, 5])
rb1.symmetric_difference(rb2).to_a #=> [1, 2, 4, 5]
rb1.xor(rb2).to_a                  #=> [1, 2, 4, 5]
(rb1 ^ rb2).to_a                   #=> [1, 2, 4, 5]

Parameters:

  • other (Roaring::Bitmap)

    The other bitmap to compute the symmetric difference with.

Returns:

  • (Roaring::Bitmap)

    The symmetric difference of the bitmap with another bitmap.



547
548
549
550
551
552
# File 'ext/roaring/src/lib.rs', line 547

fn symmetric_difference(&self, other: &Self) -> Result<Self, Error> {
    let lhs = &self.0.borrow()._data;
    let rhs = &other.0.borrow()._data;
    let d = lhs.bitxor(rhs);
    Ok(Self(RefCell::new(Wrapper { _data: d })))
}

#symmetric_difference_len(other) ⇒ Integer Also known as: xor_len

Computes the symmetric difference of the bitmap with another bitmap and returns the cardinality of the result. Useful for when you want to know the length of the result but not create a new bitmap.

Examples:

Computing the symmetric difference length of two bitmaps.

rb1 = Roaring::Bitmap.new
rb1.insert_many([1, 2, 3])
rb2 = Roaring::Bitmap.new
rb2.insert_many([3, 4, 5])
rb1.symmetric_difference_len(rb2)   #=> 4

Parameters:

  • other (Roaring::Bitmap)

    The other bitmap to compute the symmetric difference length with.

Returns:

  • (Integer)

    The cardinality of the symmetric difference of the bitmap with another bitmap.



570
571
572
573
574
575
576
# File 'ext/roaring/src/lib.rs', line 570

fn symmetric_difference_len(&self, other: &Self) -> Result<u64, Error> {
    Ok(self
        .0
        .borrow()
        ._data
        .symmetric_difference_len(&other.0.borrow()._data))
}

#to_aArray<Integer>

Returns an array of all the items in the bitmap.

Examples:

Return an array of all the items in the bitmap.

rb = Roaring::Bitmap.new
rb.insert_many([1, 2, 3])
rb.to_a     #=> [1, 2, 3]

Returns:

  • (Array<Integer>)

    An array of all the items in the bitmap.



177
178
179
# File 'ext/roaring/src/lib.rs', line 177

fn to_vec(&self) -> Result<Vec<u32>, Error> {
    Ok(self.0.borrow()._data.iter().collect())
}

#union(other) ⇒ Roaring::Bitmap Also known as: |, or

Union the bitmap with another bitmap. Bitwise OR.

Examples:

Unioning two bitmaps.

rb1 = Roaring::Bitmap.new
rb1.insert_many([1, 2, 3])
rb2 = Roaring::Bitmap.new
rb2.insert_many([3, 4, 5])
rb1.union(rb2).to_a #=> [1, 2, 3, 4, 5]
rb1.or(rb2).to_a    #=> [1, 2, 3, 4, 5]
(rb1 | rb2).to_a    #=> [1, 2, 3, 4, 5]

Parameters:

Returns:



404
405
406
407
408
409
410
# File 'ext/roaring/src/lib.rs', line 404

fn union(&self, other: &Self) -> Result<Self, Error> {
    let lhs = &self.0.borrow()._data;
    let rhs = &other.0.borrow()._data;
    let d = lhs.bitor(rhs);

    Ok(Self(RefCell::new(Wrapper { _data: d })))
}

#union_len(other) ⇒ Integer Also known as: or_len

Computes the union of the bitmap with another bitmap and returns the cardinality of the result. Useful for when you want to know the length of the result but not create a new bitmap.

Examples:

Computing the union length of two bitmaps.

rb1 = Roaring::Bitmap.new
rb1.insert_many([1, 2, 3])
rb2 = Roaring::Bitmap.new
rb2.insert_many([3, 4, 5])
rb1.union_len(rb2) #=> 5

Parameters:

Returns:

  • (Integer)

    The cardinality of the union of the bitmap with another bitmap.



428
429
430
# File 'ext/roaring/src/lib.rs', line 428

fn union_len(&self, other: &Self) -> Result<u64, Error> {
    Ok(self.0.borrow()._data.union_len(&other.0.borrow()._data))
}