Struct swiss_army_knife::bit_set::BitSet[][src]

#[repr(transparent)]
pub struct BitSet<BSA: BitSetAware>(_, _);
Expand description

Represents a BitSet suitable for use with various Linux /sys files and NUMA syscalls.

Internally uses usize to match what Linux uses.

Implementations

Creates a new empty bit set (all bits are initially zero) of the maximum possible size.

Creates a new bit set containing just element.

Creates an empty new instance of the same capacity as this one.

Creates a new empty bit set (all bits are initially zero).

Panics if size_in_words exceeds that needed to represent BSA::LinuxMaximum.

Creates a new empty bit set with no bits at all.

Parses a Linux list string used for cpu sets, core masks and NUMA nodes such as “2,4-31,32-63” and “1,2,10-20,100-2000:2/25” (see https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html for an awful description of this mad syntax).

Returns a BitSet with the zero-based indices found in the string. For example, “2,4-31,32-63” would return a set with all values between 0 to 63 except 0, 1 and 3.

linux_list_string does not have a terminating line feed (LF).

Removes the highest values from the set.

Iterate.

Iterate infinitely.

Iterate.

Capacity assuming one byte per HyperThread represented.

Suitable for use as the size of a Vec, say, which will hold HyperThread items, one per HyperThread.

Are no bits set?

This operation is a little expensive, but less expensive than self.len().

Are all bits set?

This operation is a little expensive, but less expensive than self.len().

Is this longer than maximum_length?

More efficient than calling self.len() <= maximum_length.

Is this longer than maximum_length?

More efficient than calling self.len() > maximum_length.

Number of bits set.

This operation is relatively expensive.

For an emptiness check, prefer self.is_empty() which is slightly less expensive.

Number of bits set if all bits are set.

Adds.

Adds, without checking capacity.

Does this bit set contain element?

Removes.

Pops first element.

Removes top bits that are zero and tries to shrink underlying storage.

Use only if intending to store a BitSet in memory for a long time.

Keeps only bits in both sets.

If sets are of different lengths, the missing bits are assumed to be zero.

Removes bits in other.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.