`#[repr(transparent)]pub struct Bitset { /* private fields */ }`

## Expand description

A `Bitset`

represents a set of unsigned integers.

Another name for this data structure is “bitmap”.

The current implementation is based on roaring bitmaps.

A bitset allows adding a set of integers and provides support for set operations
like unions, intersections and checks for equality or if a value is contained
in the set. `Bitset`

also contains various functions to query metadata about
the bitset, such as the minimum or maximum values or its size.

The fastest way to iterate values in a bitset is `BitsetIter`

.

The main use case for `Bitset`

is implementing complex selections for
`SelectionModel`

.

## Implementations

Sets @self to be the symmetric difference of @self and @other.

The symmetric difference is set @self to contain all values that were either contained in @self or in @other, but not in both. This operation is also called an XOR.

It is allowed for @self and @other to be the same bitset. The bitset will be emptied in that case.

`other`

the `Bitset`

to compute the difference from

Returns the largest value in @self.

If @self is empty, 0 is returned.

##### Returns

The largest value in @self

Returns the smallest value in @self.

If @self is empty, `G_MAXUINT`

is returned.

##### Returns

The smallest value in @self

Gets the number of values that were added to the set.

For example, if the set is empty, 0 is returned.

Note that this function returns a `guint64`

, because when all
values are set, the return value is `G_MAXUINT + 1`

. Unless you
are sure this cannot happen (it can’t with `GListModel`

), be sure
to use a 64bit type.

##### Returns

The number of values in the set.

Gets the number of values that are part of the set from @first to @last (inclusive).

Note that this function returns a `guint64`

, because when all values are
set, the return value is `G_MAXUINT + 1`

. Unless you are sure this cannot
happen (it can’t with `GListModel`

), be sure to use a 64bit type.

`first`

the first element to include

`last`

the last element to include

##### Returns

The number of values in the set from @first to @last.

Removes all values from the bitset so that it is empty again.

Shifts all values in @self to the left by @amount.

Values smaller than @amount are discarded.

`amount`

amount to shift all values to the left

Shifts all values in @self to the right by @amount.

Values that end up too large to be held in a #guint are discarded.

`amount`

amount to shift all values to the right

This is a support function for `GListModel`

handling, by mirroring
the `GlistModel::items-changed`

signal.

First, it “cuts” the values from @position to @removed from the bitset. That is, it removes all those values and shifts all larger values to the left by @removed places.

Then, it “pastes” new room into the bitset by shifting all values larger than @position by @added spaces to the right. This frees up space that can then be filled.

`position`

position at which to slice

`removed`

number of values to remove

`added`

number of values to add

## Trait Implementations

This method returns an ordering between `self`

and `other`

values if one exists. Read more

This method tests less than (for `self`

and `other`

) and is used by the `<`

operator. Read more

This method tests less than or equal to (for `self`

and `other`

) and is used by the `<=`

operator. Read more

This method tests greater than (for `self`

and `other`

) and is used by the `>`

operator. Read more

Returns the type identifier of `Self`

.

## Auto Trait Implementations

### impl RefUnwindSafe for Bitset

### impl UnwindSafe for Bitset

## Blanket Implementations

Mutably borrows from an owned value. Read more