### Testing Set Relationships Source: https://context7.com/petgraph/fixedbitset/llms.txt Provides examples of how to verify subset, superset, and disjoint relationships between two bitsets using boolean predicate methods. ```rust use fixedbitset::FixedBitSet; let mut subset = FixedBitSet::with_capacity(100); let mut superset = FixedBitSet::with_capacity(100); let mut disjoint = FixedBitSet::with_capacity(100); subset.insert_range(20..40); superset.insert_range(10..50); disjoint.insert_range(60..80); assert!(subset.is_subset(&superset)); assert!(superset.is_superset(&subset)); assert!(!superset.is_subset(&subset)); assert!(subset.is_disjoint(&disjoint)); assert!(!subset.is_disjoint(&superset)); ``` -------------------------------- ### Iterating Over Bits in FixedBitSet Source: https://context7.com/petgraph/fixedbitset/llms.txt Demonstrates how to iterate over set (ones) and unset (zeroes) bits using bidirectional iterators. Includes examples of reverse iteration and consuming iterators for ownership transfer. ```rust use fixedbitset::FixedBitSet; let mut bitset = FixedBitSet::with_capacity(20); bitset.insert(3); bitset.insert(7); bitset.insert(12); bitset.insert(15); let ones: Vec = bitset.ones().collect(); assert_eq!(ones, vec![3, 7, 12, 15]); let ones_rev: Vec = bitset.ones().rev().collect(); assert_eq!(ones_rev, vec![15, 12, 7, 3]); let owned_ones: Vec = bitset.clone().into_ones().collect(); assert_eq!(owned_ones, vec![3, 7, 12, 15]); let mut small = FixedBitSet::with_capacity(8); small.insert(2); small.insert(5); let zeroes: Vec = small.zeroes().collect(); assert_eq!(zeroes, vec![0, 1, 3, 4, 6, 7]); ``` -------------------------------- ### Creating a FixedBitSet Source: https://context7.com/petgraph/fixedbitset/llms.txt Demonstrates how to create new FixedBitSet instances, either empty, with a specific capacity, or initialized from existing block data. ```APIDOC ## Creating a FixedBitSet Create empty bitsets or initialize with a specific capacity. All bits start as unset (false) by default. ```rust use fixedbitset::FixedBitSet; // Create an empty bitset let empty = FixedBitSet::new(); assert_eq!(empty.len(), 0); // Create a bitset with capacity for 100 bits let mut bitset = FixedBitSet::with_capacity(100); assert_eq!(bitset.len(), 100); assert!(bitset.is_clear()); // All bits are initially unset // Create from pre-existing block data let data = vec![0b00001100]; // Bits 2 and 3 are set let from_blocks = FixedBitSet::with_capacity_and_blocks(8, data); assert!(from_blocks.contains(2)); assert!(from_blocks.contains(3)); assert!(!from_blocks.contains(0)); ``` ``` -------------------------------- ### Creating a FixedBitSet in Rust Source: https://context7.com/petgraph/fixedbitset/llms.txt Demonstrates how to create new FixedBitSet instances in Rust. This includes creating an empty bitset, initializing with a specific capacity, and constructing from pre-existing block data. All bits are initialized to unset (false) by default. ```rust use fixedbitset::FixedBitSet; // Create an empty bitset let empty = FixedBitSet::new(); assert_eq!(empty.len(), 0); // Create a bitset with capacity for 100 bits let mut bitset = FixedBitSet::with_capacity(100); assert_eq!(bitset.len(), 100); assert!(bitset.is_clear()); // All bits are initially unset // Create from pre-existing block data let data = vec![0b00001100]; // Bits 2 and 3 are set let from_blocks = FixedBitSet::with_capacity_and_blocks(8, data); assert!(from_blocks.contains(2)); assert!(from_blocks.contains(3)); assert!(!from_blocks.contains(0)); ``` -------------------------------- ### Format FixedBitSet as Binary Strings Source: https://context7.com/petgraph/fixedbitset/llms.txt Shows how to format a FixedBitSet into binary string representations for debugging and display purposes, including options with and without a '0b' prefix. ```rust use fixedbitset::FixedBitSet; let mut bitset = FixedBitSet::with_capacity(8); bitset.insert(1); bitset.insert(4); bitset.insert(5); // Binary format (leftmost is bit 0) let binary = format!("{:b}", bitset); assert_eq!(binary, "01001100"); // With 0b prefix let prefixed = format!("{:#b}", bitset); assert_eq!(prefixed, "0b01001100"); // Display trait uses binary format let display = format!("{}", bitset); assert_eq!(display, "01001100"); ``` -------------------------------- ### Grow and Dynamic Insertion Source: https://context7.com/petgraph/fixedbitset/llms.txt Explains how to dynamically expand the capacity of a FixedBitSet using `grow` and how `grow_and_insert` can automatically resize the bitset when inserting bits beyond its current bounds. ```APIDOC ## Grow and Dynamic Insertion Expand the bitset capacity dynamically or insert bits beyond current bounds. ```rust use fixedbitset::FixedBitSet; let mut bitset = FixedBitSet::with_capacity(10); assert_eq!(bitset.len(), 10); // Grow to accommodate more bits bitset.grow(100); assert_eq!(bitset.len(), 100); // grow_and_insert: grow if needed and insert in one operation let mut dynamic = FixedBitSet::default(); for i in (0..100).step_by(3) { dynamic.grow_and_insert(i); // Automatically grows as needed } assert_eq!(dynamic.count_ones(..), 34); ``` ``` -------------------------------- ### Build FixedBitSet from Iterators and Extend Source: https://context7.com/petgraph/fixedbitset/llms.txt Demonstrates creating FixedBitSets from iterators of indices and extending existing bitsets. It also shows creating a copy from an iterator of ones. ```rust use fixedbitset::FixedBitSet; // From an iterator of bit indices let indices = vec![1, 5, 10, 15, 20]; let bitset: FixedBitSet = indices.iter().cloned().collect(); assert!(bitset.contains(5)); assert!(bitset.contains(15)); assert!(!bitset.contains(6)); // Extend an existing bitset let mut bitset = FixedBitSet::with_capacity(10); bitset.insert(0); bitset.extend(vec![5, 10, 15, 100]); // Automatically grows assert!(bitset.contains(100)); assert_eq!(bitset.len(), 101); // Create from ones iterator let original = indices.iter().cloned().collect::(); let copy: FixedBitSet = original.ones().collect(); assert_eq!( original.ones().collect::>(), copy.ones().collect::>() ); ``` -------------------------------- ### Insert and Remove Bits Source: https://context7.com/petgraph/fixedbitset/llms.txt Shows how to insert, remove, set, and toggle individual bits within a FixedBitSet. Also demonstrates the `put` operation which inserts and returns the previous state. ```APIDOC ## Insert and Remove Bits Enable or disable individual bits by index. Panics if the index exceeds the bitset's length. ```rust use fixedbitset::FixedBitSet; let mut bitset = FixedBitSet::with_capacity(50); // Insert (enable) a bit bitset.insert(10); assert!(bitset.contains(10)); // Remove (disable) a bit bitset.remove(10); assert!(!bitset.contains(10)); // Set a bit to a specific value bitset.set(15, true); assert!(bitset.contains(15)); bitset.set(15, false); assert!(!bitset.contains(15)); // Toggle a bit (invert its state) bitset.toggle(20); assert!(bitset.contains(20)); bitset.toggle(20); assert!(!bitset.contains(20)); // Put: insert and return previous value bitset.insert(5); let was_set = bitset.put(5); // Returns true (was already set) assert!(was_set); ``` ``` -------------------------------- ### Growing and Dynamic Insertion in FixedBitSet (Rust) Source: https://context7.com/petgraph/fixedbitset/llms.txt Explains how to dynamically adjust the size of a FixedBitSet in Rust. The `grow` method expands the capacity to a specified size, while `grow_and_insert` automatically increases the capacity if an insertion would exceed the current bounds. This is useful for bitsets whose final size is not known at creation. ```rust use fixedbitset::FixedBitSet; let mut bitset = FixedBitSet::with_capacity(10); assert_eq!(bitset.len(), 10); // Grow to accommodate more bits bitset.grow(100); assert_eq!(bitset.len(), 100); // grow_and_insert: grow if needed and insert in one operation let mut dynamic = FixedBitSet::default(); for i in (0..100).step_by(3) { dynamic.grow_and_insert(i); // Automatically grows as needed } assert_eq!(dynamic.count_ones(..), 34); ``` -------------------------------- ### Iterating Over Bits Source: https://context7.com/petgraph/fixedbitset/llms.txt Demonstrates how to iterate over set bits (ones) and unset bits (zeroes) in a FixedBitSet, including reverse iteration and consuming iterators. ```APIDOC ## Iterating Over Bits ### Description Iterate over set bits (ones) or unset bits (zeroes) with bidirectional support. ### Method N/A (Iterator methods) ### Endpoint N/A ### Parameters N/A ### Request Example ```rust use fixedbitset::FixedBitSet; let mut bitset = FixedBitSet::with_capacity(20); bitset.insert(3); bitset.insert(7); bitset.insert(12); bitset.insert(15); // Iterate over set bits (ones) let ones: Vec = bitset.ones().collect(); assert_eq!(ones, vec![3, 7, 12, 15]); // Reverse iteration (DoubleEndedIterator) let ones_rev: Vec = bitset.ones().rev().collect(); assert_eq!(ones_rev, vec![15, 12, 7, 3]); // Consuming iterator (takes ownership) let owned_ones: Vec = bitset.clone().into_ones().collect(); assert_eq!(owned_ones, vec![3, 7, 12, 15]); // Iterate over unset bits (zeroes) let mut small = FixedBitSet::with_capacity(8); small.insert(2); small.insert(5); let zeroes: Vec = small.zeroes().collect(); assert_eq!(zeroes, vec![0, 1, 3, 4, 6, 7]); ``` ### Response N/A ### Response Example N/A ``` -------------------------------- ### Performing Mathematical Set Operations Source: https://context7.com/petgraph/fixedbitset/llms.txt Shows how to calculate intersections, unions, differences, and symmetric differences between two bitsets. Also demonstrates how to retrieve counts without allocating new vectors. ```rust use fixedbitset::FixedBitSet; let mut a = FixedBitSet::with_capacity(100); let mut b = FixedBitSet::with_capacity(100); a.insert_range(0..50); b.insert_range(30..80); let intersection: Vec = a.intersection(&b).collect(); assert_eq!(intersection, (30..50).collect::>()); let union: Vec = a.union(&b).collect(); assert_eq!(union, (0..80).collect::>()); let difference: Vec = a.difference(&b).collect(); assert_eq!(difference, (0..30).collect::>()); let sym_diff: Vec = a.symmetric_difference(&b).collect(); let expected: Vec = (0..30).chain(50..80).collect(); assert_eq!(sym_diff, expected); assert_eq!(a.intersection_count(&b), 20); assert_eq!(a.union_count(&b), 80); assert_eq!(a.difference_count(&b), 30); assert_eq!(a.symmetric_difference_count(&b), 60); ``` -------------------------------- ### Performing In-Place Set Operations Source: https://context7.com/petgraph/fixedbitset/llms.txt Illustrates how to modify an existing bitset directly using in-place methods like intersect_with, union_with, and difference_with to optimize memory usage. ```rust use fixedbitset::FixedBitSet; let mut a = FixedBitSet::with_capacity(100); let mut b = FixedBitSet::with_capacity(100); a.insert_range(0..60); b.insert_range(40..100); let mut result = a.clone(); result.intersect_with(&b); assert_eq!(result.count_ones(..), 20); let mut result = a.clone(); result.union_with(&b); assert_eq!(result.count_ones(..), 100); let mut result = a.clone(); result.difference_with(&b); assert_eq!(result.count_ones(..), 40); let mut result = a.clone(); result.symmetric_difference_with(&b); assert_eq!(result.count_ones(..), 80); ``` -------------------------------- ### Using Bitwise Operators for Set Logic Source: https://context7.com/petgraph/fixedbitset/llms.txt Demonstrates the use of standard Rust operators (&, |, ^) and assignment operators (&=, |=, ^=) to perform set operations on bitsets. ```rust use fixedbitset::FixedBitSet; let mut a = FixedBitSet::with_capacity(64); let mut b = FixedBitSet::with_capacity(64); a.insert_range(0..40); b.insert_range(20..60); let and_result = &a & &b; assert_eq!(and_result.count_ones(..), 20); let or_result = &a | &b; assert_eq!(or_result.count_ones(..), 60); let xor_result = &a ^ &b; assert_eq!(xor_result.count_ones(..), 40); let mut c = a.clone(); c &= &b; assert_eq!(c.count_ones(..), 20); let mut d = a.clone(); d |= &b; assert_eq!(d.count_ones(..), 60); let mut e = a.clone(); e ^= &b; assert_eq!(e.count_ones(..), 40); ``` -------------------------------- ### Counting Bits in FixedBitSet (Rust) Source: https://context7.com/petgraph/fixedbitset/llms.txt Shows how to count the number of set (ones) and unset (zeroes) bits in a FixedBitSet in Rust, both for the entire bitset and within specific ranges. It also covers finding the minimum and maximum indices of set bits, and checking if the bitset is entirely clear or full. ```rust use fixedbitset::FixedBitSet; let mut bitset = FixedBitSet::with_capacity(100); bitset.insert(7); bitset.insert(11); bitset.insert(35); bitset.insert(77); // Count ones (set bits) assert_eq!(bitset.count_ones(..), 4); // All bits assert_eq!(bitset.count_ones(..12), 2); // Bits 0-11 assert_eq!(bitset.count_ones(10..80), 3); // Bits 10-79 // Count zeroes (unset bits) assert_eq!(bitset.count_zeroes(..), 96); // All unset bits assert_eq!(bitset.count_zeroes(0..10), 9); // 10 bits minus one set // Find minimum and maximum set bits assert_eq!(bitset.minimum(), Some(7)); assert_eq!(bitset.maximum(), Some(77)); // Check if clear or full assert!(!bitset.is_clear()); assert!(!bitset.is_full()); bitset.clear(); assert!(bitset.is_clear()); assert_eq!(bitset.minimum(), None); ``` -------------------------------- ### Counting Bits Source: https://context7.com/petgraph/fixedbitset/llms.txt Explains how to count the number of set (ones) or unset (zeroes) bits within the entire FixedBitSet or specific ranges. Also covers finding the minimum and maximum set bits, and checking if the bitset is entirely clear or full. ```APIDOC ## Counting Bits Count set or unset bits in the entire bitset or within a range. ```rust use fixedbitset::FixedBitSet; let mut bitset = FixedBitSet::with_capacity(100); bitset.insert(7); bitset.insert(11); bitset.insert(35); bitset.insert(77); // Count ones (set bits) assert_eq!(bitset.count_ones(..), 4); // All bits assert_eq!(bitset.count_ones(..12), 2); // Bits 0-11 assert_eq!(bitset.count_ones(10..80), 3); // Bits 10-79 // Count zeroes (unset bits) assert_eq!(bitset.count_zeroes(..), 96); // All unset bits assert_eq!(bitset.count_zeroes(0..10), 9); // 10 bits minus one set // Find minimum and maximum set bits assert_eq!(bitset.minimum(), Some(7)); assert_eq!(bitset.maximum(), Some(77)); // Check if clear or full assert!(!bitset.is_clear()); assert!(!bitset.is_full()); bitset.clear(); assert!(bitset.is_clear()); assert_eq!(bitset.minimum(), None); ``` ``` -------------------------------- ### Set Relationships Source: https://context7.com/petgraph/fixedbitset/llms.txt Test subset, superset, and disjoint relationships between FixedBitSets. ```APIDOC ## Set Relationships ### Description Test subset, superset, and disjoint relationships between bitsets. ### Method N/A (Boolean methods) ### Endpoint N/A ### Parameters N/A ### Request Example ```rust use fixedbitset::FixedBitSet; let mut subset = FixedBitSet::with_capacity(100); let mut superset = FixedBitSet::with_capacity(100); let mut disjoint = FixedBitSet::with_capacity(100); subset.insert_range(20..40); superset.insert_range(10..50); disjoint.insert_range(60..80); // Subset/superset relationships assert!(subset.is_subset(&superset)); assert!(superset.is_superset(&subset)); assert!(!superset.is_subset(&subset)); // Disjoint (no common elements) assert!(subset.is_disjoint(&disjoint)); assert!(!subset.is_disjoint(&superset)); ``` ### Response N/A ### Response Example N/A ``` -------------------------------- ### Inserting and Removing Bits in FixedBitSet (Rust) Source: https://context7.com/petgraph/fixedbitset/llms.txt Illustrates how to modify individual bits within a FixedBitSet in Rust. This covers inserting (setting to true), removing (setting to false), setting to a specific boolean value, and toggling the state of a bit. The `put` method is also shown, which inserts a bit and returns its previous state. ```rust use fixedbitset::FixedBitSet; let mut bitset = FixedBitSet::with_capacity(50); // Insert (enable) a bit bitset.insert(10); assert!(bitset.contains(10)); // Remove (disable) a bit bitset.remove(10); assert!(!bitset.contains(10)); // Set a bit to a specific value bitset.set(15, true); assert!(bitset.contains(15)); bitset.set(15, false); assert!(!bitset.contains(15)); // Toggle a bit (invert its state) bitset.toggle(20); assert!(bitset.contains(20)); bitset.toggle(20); assert!(!bitset.contains(20)); // Put: insert and return previous value bitset.insert(5); let was_set = bitset.put(5); // Returns true (was already set) assert!(was_set); ``` -------------------------------- ### Access FixedBitSet Slice Storage Source: https://context7.com/petgraph/fixedbitset/llms.txt Illustrates how to access the underlying block storage of a FixedBitSet using read-only and mutable slices. It also covers initializing a FixedBitSet from a vector of blocks. ```rust use fixedbitset::FixedBitSet; let mut bitset = FixedBitSet::with_capacity(128); bitset.insert(0); bitset.insert(64); // Read-only slice access let slice = bitset.as_slice(); assert_eq!(slice[0], 1); // Bit 0 is set // Mutable slice access (use with caution) let mut_slice = bitset.as_mut_slice(); mut_slice[0] |= 0b10; // Set bit 1 assert!(bitset.contains(1)); // Initialize from blocks let blocks = vec![0b1010, 0b0101]; let from_blocks = FixedBitSet::with_capacity_and_blocks(128, blocks); assert!(from_blocks.contains(1)); assert!(from_blocks.contains(3)); ``` -------------------------------- ### Range Operations Source: https://context7.com/petgraph/fixedbitset/llms.txt Details how to perform bulk operations on ranges of bits, including inserting, removing, toggling, and setting ranges, as well as checking for the presence of all or any set bits within a range. ```APIDOC ## Range Operations Perform bulk operations on ranges of bits efficiently. ```rust use fixedbitset::FixedBitSet; let mut bitset = FixedBitSet::with_capacity(100); // Insert a range of bits bitset.insert_range(10..30); // Set bits 10-29 bitset.insert_range(..5); // Set bits 0-4 bitset.insert_range(90..); // Set bits 90-99 // Remove a range bitset.remove_range(15..25); // Toggle a range bitset.toggle_range(0..10); // Set range to a specific value bitset.set_range(50..60, true); bitset.set_range(50..55, false); // Check if all bits in range are set let mut full_range = FixedBitSet::with_capacity(10); full_range.insert_range(..); assert!(full_range.contains_all_in_range(..)); assert!(full_range.contains_all_in_range(2..8)); // Check if any bit in range is set let mut partial = FixedBitSet::with_capacity(100); partial.insert(50); assert!(partial.contains_any_in_range(40..60)); assert!(!partial.contains_any_in_range(0..40)); ``` ``` -------------------------------- ### Range Operations on FixedBitSet (Rust) Source: https://context7.com/petgraph/fixedbitset/llms.txt Details how to perform bulk operations on contiguous ranges of bits within a FixedBitSet in Rust. This includes inserting, removing, toggling, and setting all bits within a specified range. It also covers checking if all or any bits within a range are set. ```rust use fixedbitset::FixedBitSet; let mut bitset = FixedBitSet::with_capacity(100); // Insert a range of bits bitset.insert_range(10..30); // Set bits 10-29 bitset.insert_range(..5); // Set bits 0-4 bitset.insert_range(90..); // Set bits 90-99 // Remove a range bitset.remove_range(15..25); // Toggle a range bitset.toggle_range(0..10); // Set range to a specific value bitset.set_range(50..60, true); bitset.set_range(50..55, false); // Check if all bits in range are set let mut full_range = FixedBitSet::with_capacity(10); full_range.insert_range(..); assert!(full_range.contains_all_in_range(..)); assert!(full_range.contains_all_in_range(2..8)); // Check if any bit in range is set let mut partial = FixedBitSet::with_capacity(100); partial.insert(50); assert!(partial.contains_any_in_range(40..60)); assert!(!partial.contains_any_in_range(0..40)); ``` -------------------------------- ### Set Operations Source: https://context7.com/petgraph/fixedbitset/llms.txt Perform mathematical set operations such as intersection, union, difference, and symmetric difference between two FixedBitSets. ```APIDOC ## Set Operations ### Description Perform mathematical set operations between two bitsets. ### Method N/A (Iterator methods) ### Endpoint N/A ### Parameters N/A ### Request Example ```rust use fixedbitset::FixedBitSet; let mut a = FixedBitSet::with_capacity(100); let mut b = FixedBitSet::with_capacity(100); a.insert_range(0..50); // A = {0..49} b.insert_range(30..80); // B = {30..79} // Intersection (A ∩ B): bits in both sets let intersection: Vec = a.intersection(&b).collect(); assert_eq!(intersection, (30..50).collect::>()); // Union (A ∪ B): bits in either set let union: Vec = a.union(&b).collect(); assert_eq!(union, (0..80).collect::>()); // Difference (A \ B): bits in A but not in B let difference: Vec = a.difference(&b).collect(); assert_eq!(difference, (0..30).collect::>()); // Symmetric Difference (A △ B): bits in one but not both let sym_diff: Vec = a.symmetric_difference(&b).collect(); let expected: Vec = (0..30).chain(50..80).collect(); assert_eq!(sym_diff, expected); // Count operations (without allocation) assert_eq!(a.intersection_count(&b), 20); assert_eq!(a.union_count(&b), 80); assert_eq!(a.difference_count(&b), 30); assert_eq!(a.symmetric_difference_count(&b), 60); ``` ### Response N/A ### Response Example N/A ``` -------------------------------- ### Bitwise Operators Source: https://context7.com/petgraph/fixedbitset/llms.txt Utilize standard Rust bitwise operators (&, |, ^, &=, |=, ^=) for performing set operations on FixedBitSets. ```APIDOC ## Bitwise Operators ### Description Use standard Rust bitwise operators for set operations. ### Method N/A (Operator overloading) ### Endpoint N/A ### Parameters N/A ### Request Example ```rust use fixedbitset::FixedBitSet; let mut a = FixedBitSet::with_capacity(64); let mut b = FixedBitSet::with_capacity(64); a.insert_range(0..40); b.insert_range(20..60); // Bitwise AND (intersection) let and_result = &a & &b; assert_eq!(and_result.count_ones(..), 20); // Bitwise OR (union) let or_result = &a | &b; assert_eq!(or_result.count_ones(..), 60); // Bitwise XOR (symmetric difference) let xor_result = &a ^ &b; assert_eq!(xor_result.count_ones(..), 40); // Assignment operators let mut c = a.clone(); c &= &b; // c = c ∩ b assert_eq!(c.count_ones(..), 20); let mut d = a.clone(); d |= &b; // d = d ∪ b assert_eq!(d.count_ones(..), 60); let mut e = a.clone(); e ^= &b; // e = e △ b assert_eq!(e.count_ones(..), 40); ``` ### Response N/A ### Response Example N/A ``` -------------------------------- ### In-Place Set Operations Source: https://context7.com/petgraph/fixedbitset/llms.txt Modify a FixedBitSet in-place by applying set operations with another FixedBitSet. ```APIDOC ## In-Place Set Operations ### Description Modify a bitset in-place using set operations with another bitset. ### Method N/A (In-place methods) ### Endpoint N/A ### Parameters N/A ### Request Example ```rust use fixedbitset::FixedBitSet; let mut a = FixedBitSet::with_capacity(100); let mut b = FixedBitSet::with_capacity(100); a.insert_range(0..60); b.insert_range(40..100); // In-place intersection (A = A ∩ B) let mut result = a.clone(); result.intersect_with(&b); assert_eq!(result.count_ones(..), 20); // {40..59} // In-place union (A = A ∪ B) let mut result = a.clone(); result.union_with(&b); assert_eq!(result.count_ones(..), 100); // {0..99} // In-place difference (A = A \ B) let mut result = a.clone(); result.difference_with(&b); assert_eq!(result.count_ones(..), 40); // {0..39} // In-place symmetric difference (A = A △ B) let mut result = a.clone(); result.symmetric_difference_with(&b); assert_eq!(result.count_ones(..), 80); // {0..39} ∪ {60..99} ``` ### Response N/A ### Response Example N/A ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.