#[repr(transparent)]
pub struct Mask<T, const LANES: usize>(_)
where
    T: MaskElement,
    LaneCount<LANES>: SupportedLaneCount
;
🔬This is a nightly-only experimental API. (portable_simd #86656)
Expand description

A SIMD vector mask for LANES elements of width specified by Element.

Masks represent boolean inclusion/exclusion on a per-lane basis.

The layout of this type is unspecified.

Implementations

🔬This is a nightly-only experimental API. (portable_simd #86656)

Construct a mask by setting all lanes to the given value.

🔬This is a nightly-only experimental API. (portable_simd #86656)

Converts an array of bools to a SIMD mask.

🔬This is a nightly-only experimental API. (portable_simd #86656)

Converts a SIMD mask to an array of bools.

🔬This is a nightly-only experimental API. (portable_simd #86656)

Converts a vector of integers to a mask, where 0 represents false and -1 represents true.

Safety

All lanes must be either 0 or -1.

🔬This is a nightly-only experimental API. (portable_simd #86656)

Converts a vector of integers to a mask, where 0 represents false and -1 represents true.

Panics

Panics if any lane is not 0 or -1.

🔬This is a nightly-only experimental API. (portable_simd #86656)

Converts the mask to a vector of integers, where 0 represents false and -1 represents true.

🔬This is a nightly-only experimental API. (portable_simd #86656)

Converts the mask to a mask of any other lane size.

🔬This is a nightly-only experimental API. (portable_simd #86656)

Tests the value of the specified lane.

Safety

lane must be less than LANES.

🔬This is a nightly-only experimental API. (portable_simd #86656)

Tests the value of the specified lane.

Panics

Panics if lane is greater than or equal to the number of lanes in the vector.

🔬This is a nightly-only experimental API. (portable_simd #86656)

Sets the value of the specified lane.

Safety

lane must be less than LANES.

🔬This is a nightly-only experimental API. (portable_simd #86656)

Sets the value of the specified lane.

Panics

Panics if lane is greater than or equal to the number of lanes in the vector.

🔬This is a nightly-only experimental API. (portable_simd #86656)

Returns true if any lane is set, or false otherwise.

🔬This is a nightly-only experimental API. (portable_simd #86656)

Returns true if all lanes are set, or false otherwise.

🔬This is a nightly-only experimental API. (portable_simd #86656)

Choose lanes from two vectors.

For each lane in the mask, choose the corresponding lane from true_values if that lane mask is true, and false_values if that lane mask is false.

Examples
let a = Simd::from_array([0, 1, 2, 3]);
let b = Simd::from_array([4, 5, 6, 7]);
let mask = Mask::from_array([true, false, false, true]);
let c = mask.select(a, b);
assert_eq!(c.to_array(), [0, 5, 6, 3]);
Run
🔬This is a nightly-only experimental API. (portable_simd #86656)

Choose lanes from two masks.

For each lane in the mask, choose the corresponding lane from true_values if that lane mask is true, and false_values if that lane mask is false.

Examples
let a = Mask::<i32, 4>::from_array([true, true, false, false]);
let b = Mask::<i32, 4>::from_array([false, false, true, true]);
let mask = Mask::<i32, 4>::from_array([true, false, false, true]);
let c = mask.select_mask(a, b);
assert_eq!(c.to_array(), [true, false, true, false]);
Run

Trait Implementations

The resulting type after applying the & operator.
Performs the & operation. Read more
The resulting type after applying the & operator.
Performs the & operation. Read more
The resulting type after applying the & operator.
Performs the & operation. Read more
Performs the &= operation. Read more
Performs the &= operation. Read more
The resulting type after applying the | operator.
Performs the | operation. Read more
The resulting type after applying the | operator.
Performs the | operation. Read more
The resulting type after applying the | operator.
Performs the | operation. Read more
Performs the |= operation. Read more
Performs the |= operation. Read more
The resulting type after applying the ^ operator.
Performs the ^ operation. Read more
The resulting type after applying the ^ operator.
Performs the ^ operation. Read more
The resulting type after applying the ^ operator.
Performs the ^ operation. Read more
Performs the ^= operation. Read more
Performs the ^= operation. Read more
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
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
The resulting type after applying the ! operator.
Performs the unary ! operation. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
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
🔬This is a nightly-only experimental API. (portable_simd #86656)
Returns the lane-wise maximum with other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Returns the lane-wise minimum with other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Restrict each lane to a certain interval. Read more
🔬This is a nightly-only experimental API. (portable_simd #86656)
Returns the lane-wise maximum with other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Returns the lane-wise minimum with other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Restrict each lane to a certain interval. Read more
🔬This is a nightly-only experimental API. (portable_simd #86656)
Returns the lane-wise maximum with other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Returns the lane-wise minimum with other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Restrict each lane to a certain interval. Read more
🔬This is a nightly-only experimental API. (portable_simd #86656)
Returns the lane-wise maximum with other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Returns the lane-wise minimum with other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Restrict each lane to a certain interval. Read more
🔬This is a nightly-only experimental API. (portable_simd #86656)
Returns the lane-wise maximum with other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Returns the lane-wise minimum with other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Restrict each lane to a certain interval. Read more
🔬This is a nightly-only experimental API. (portable_simd #86656)
The mask type returned by each comparison.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is equal to the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is equal to the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
The mask type returned by each comparison.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is equal to the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is equal to the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
The mask type returned by each comparison.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is equal to the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is equal to the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
The mask type returned by each comparison.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is equal to the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is equal to the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
The mask type returned by each comparison.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is equal to the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is equal to the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is less than the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is less than or equal to the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is greater than the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is greater than or equal to the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is less than the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is less than or equal to the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is greater than the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is greater than or equal to the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is less than the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is less than or equal to the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is greater than the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is greater than or equal to the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is less than the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is less than or equal to the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is greater than the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is greater than or equal to the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is less than the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is less than or equal to the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is greater than the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Test if each lane is greater than or equal to the corresponding lane in other.
🔬This is a nightly-only experimental API. (portable_simd #86656)
The integer bitmask type.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Converts a mask to a bitmask.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Converts a bitmask to a mask.
🔬This is a nightly-only experimental API. (portable_simd #86656)
The integer bitmask type.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Converts a mask to a bitmask.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Converts a bitmask to a mask.
🔬This is a nightly-only experimental API. (portable_simd #86656)
The integer bitmask type.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Converts a mask to a bitmask.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Converts a bitmask to a mask.
🔬This is a nightly-only experimental API. (portable_simd #86656)
The integer bitmask type.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Converts a mask to a bitmask.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Converts a bitmask to a mask.
🔬This is a nightly-only experimental API. (portable_simd #86656)
The integer bitmask type.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Converts a mask to a bitmask.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Converts a bitmask to a mask.
🔬This is a nightly-only experimental API. (portable_simd #86656)
The integer bitmask type.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Converts a mask to a bitmask.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Converts a bitmask to a mask.
🔬This is a nightly-only experimental API. (portable_simd #86656)
The integer bitmask type.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Converts a mask to a bitmask.
🔬This is a nightly-only experimental API. (portable_simd #86656)
Converts a bitmask to a mask.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.