Trait simba::scalar::SubsetOf

source ·
pub trait SubsetOf<T>: Sized {
    // Required methods
    fn to_superset(&self) -> T;
    fn from_superset_unchecked(element: &T) -> Self;
    fn is_in_subset(element: &T) -> bool;

    // Provided method
    fn from_superset(element: &T) -> Option<Self> { ... }
}
Expand description

Nested sets and conversions between them (using an injective mapping). Useful to work with substructures. In generic code, it is preferable to use SupersetOf as trait bound whenever possible instead of SubsetOf (because SupersetOf is automatically implemented whenever SubsetOf is).

The notion of “nested sets” is very broad and applies to what the types are supposed to represent, independently from their actual implementation details and limitations. For example:

  • f32 and f64 are both supposed to represent reals and are thus considered equal (even if in practice f64 has more elements).
  • u32 and i8 are respectively supposed to represent natural and relative numbers. Thus, u32 is a subset of i8.
  • A quaternion and a 3x3 orthogonal matrix with unit determinant are both sets of rotations. They can thus be considered equal.

In other words, implementation details due to machine limitations are ignored (otherwise we could not even, e.g., convert a u64 to an i64). If considering those limitations are important, other crates allowing you to query the limitations of given types should be used.

Required Methods§

source

fn to_superset(&self) -> T

The inclusion map: converts self to the equivalent element of its superset.

source

fn from_superset_unchecked(element: &T) -> Self

Use with care! Same as self.to_superset but without any property checks. Always succeeds.

source

fn is_in_subset(element: &T) -> bool

Checks if element is actually part of the subset Self (and can be converted to it).

Provided Methods§

source

fn from_superset(element: &T) -> Option<Self>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset.

Must return None if element has no equivalent in Self.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl SubsetOf<f32> for f32

source§

impl SubsetOf<f32> for f64

source§

impl SubsetOf<f32> for i8

source§

impl SubsetOf<f32> for i16

source§

impl SubsetOf<f32> for i32

source§

impl SubsetOf<f32> for i64

source§

impl SubsetOf<f32> for i128

source§

impl SubsetOf<f32> for isize

source§

impl SubsetOf<f32> for u8

source§

impl SubsetOf<f32> for u16

source§

impl SubsetOf<f32> for u32

source§

impl SubsetOf<f32> for u64

source§

impl SubsetOf<f32> for u128

source§

impl SubsetOf<f32> for usize

source§

impl SubsetOf<f64> for f32

source§

impl SubsetOf<f64> for f64

source§

impl SubsetOf<f64> for i8

source§

impl SubsetOf<f64> for i16

source§

impl SubsetOf<f64> for i32

source§

impl SubsetOf<f64> for i64

source§

impl SubsetOf<f64> for i128

source§

impl SubsetOf<f64> for isize

source§

impl SubsetOf<f64> for u8

source§

impl SubsetOf<f64> for u16

source§

impl SubsetOf<f64> for u32

source§

impl SubsetOf<f64> for u64

source§

impl SubsetOf<f64> for u128

source§

impl SubsetOf<f64> for usize

source§

impl SubsetOf<i8> for i8

source§

impl SubsetOf<i8> for i16

source§

impl SubsetOf<i8> for i32

source§

impl SubsetOf<i8> for i64

source§

impl SubsetOf<i8> for i128

source§

impl SubsetOf<i8> for isize

source§

impl SubsetOf<i8> for u8

source§

impl SubsetOf<i8> for u16

source§

impl SubsetOf<i8> for u32

source§

impl SubsetOf<i8> for u64

source§

impl SubsetOf<i8> for u128

source§

impl SubsetOf<i8> for usize

source§

impl SubsetOf<i16> for i8

source§

impl SubsetOf<i16> for i16

source§

impl SubsetOf<i16> for i32

source§

impl SubsetOf<i16> for i64

source§

impl SubsetOf<i16> for i128

source§

impl SubsetOf<i16> for isize

source§

impl SubsetOf<i16> for u8

source§

impl SubsetOf<i16> for u16

source§

impl SubsetOf<i16> for u32

source§

impl SubsetOf<i16> for u64

source§

impl SubsetOf<i16> for u128

source§

impl SubsetOf<i16> for usize

source§

impl SubsetOf<i32> for i8

source§

impl SubsetOf<i32> for i16

source§

impl SubsetOf<i32> for i32

source§

impl SubsetOf<i32> for i64

source§

impl SubsetOf<i32> for i128

source§

impl SubsetOf<i32> for isize

source§

impl SubsetOf<i32> for u8

source§

impl SubsetOf<i32> for u16

source§

impl SubsetOf<i32> for u32

source§

impl SubsetOf<i32> for u64

source§

impl SubsetOf<i32> for u128

source§

impl SubsetOf<i32> for usize

source§

impl SubsetOf<i64> for i8

source§

impl SubsetOf<i64> for i16

source§

impl SubsetOf<i64> for i32

source§

impl SubsetOf<i64> for i64

source§

impl SubsetOf<i64> for i128

source§

impl SubsetOf<i64> for isize

source§

impl SubsetOf<i64> for u8

source§

impl SubsetOf<i64> for u16

source§

impl SubsetOf<i64> for u32

source§

impl SubsetOf<i64> for u64

source§

impl SubsetOf<i64> for u128

source§

impl SubsetOf<i64> for usize

source§

impl SubsetOf<i128> for i8

source§

impl SubsetOf<i128> for i16

source§

impl SubsetOf<i128> for i32

source§

impl SubsetOf<i128> for i64

source§

impl SubsetOf<i128> for i128

source§

impl SubsetOf<i128> for isize

source§

impl SubsetOf<i128> for u8

source§

impl SubsetOf<i128> for u16

source§

impl SubsetOf<i128> for u32

source§

impl SubsetOf<i128> for u64

source§

impl SubsetOf<i128> for u128

source§

impl SubsetOf<i128> for usize

source§

impl SubsetOf<isize> for i8

source§

impl SubsetOf<isize> for i16

source§

impl SubsetOf<isize> for i32

source§

impl SubsetOf<isize> for i64

source§

impl SubsetOf<isize> for i128

source§

impl SubsetOf<isize> for isize

source§

impl SubsetOf<isize> for u8

source§

impl SubsetOf<isize> for u16

source§

impl SubsetOf<isize> for u32

source§

impl SubsetOf<isize> for u64

source§

impl SubsetOf<isize> for u128

source§

impl SubsetOf<isize> for usize

source§

impl SubsetOf<u8> for u8

source§

impl SubsetOf<u8> for u16

source§

impl SubsetOf<u8> for u32

source§

impl SubsetOf<u8> for u64

source§

impl SubsetOf<u8> for u128

source§

impl SubsetOf<u8> for usize

source§

impl SubsetOf<u16> for u8

source§

impl SubsetOf<u16> for u16

source§

impl SubsetOf<u16> for u32

source§

impl SubsetOf<u16> for u64

source§

impl SubsetOf<u16> for u128

source§

impl SubsetOf<u16> for usize

source§

impl SubsetOf<u32> for u8

source§

impl SubsetOf<u32> for u16

source§

impl SubsetOf<u32> for u32

source§

impl SubsetOf<u32> for u64

source§

impl SubsetOf<u32> for u128

source§

impl SubsetOf<u32> for usize

source§

impl SubsetOf<u64> for u8

source§

impl SubsetOf<u64> for u16

source§

impl SubsetOf<u64> for u32

source§

impl SubsetOf<u64> for u64

source§

impl SubsetOf<u64> for u128

source§

impl SubsetOf<u64> for usize

source§

impl SubsetOf<u128> for u8

source§

impl SubsetOf<u128> for u16

source§

impl SubsetOf<u128> for u32

source§

impl SubsetOf<u128> for u64

source§

impl SubsetOf<u128> for u128

source§

impl SubsetOf<u128> for usize

source§

impl SubsetOf<usize> for u8

source§

impl SubsetOf<usize> for u16

source§

impl SubsetOf<usize> for u32

source§

impl SubsetOf<usize> for u64

source§

impl SubsetOf<usize> for u128

source§

impl SubsetOf<usize> for usize

source§

impl SubsetOf<WideF32x4> for f32

source§

impl SubsetOf<WideF32x4> for f64

source§

impl SubsetOf<WideF32x4> for i8

source§

impl SubsetOf<WideF32x4> for i16

source§

impl SubsetOf<WideF32x4> for i32

source§

impl SubsetOf<WideF32x4> for i64

source§

impl SubsetOf<WideF32x4> for isize

source§

impl SubsetOf<WideF32x4> for u8

source§

impl SubsetOf<WideF32x4> for u16

source§

impl SubsetOf<WideF32x4> for u32

source§

impl SubsetOf<WideF32x4> for u64

source§

impl SubsetOf<WideF32x4> for usize

source§

impl SubsetOf<WideF32x8> for f32

source§

impl SubsetOf<WideF32x8> for f64

source§

impl SubsetOf<WideF32x8> for i8

source§

impl SubsetOf<WideF32x8> for i16

source§

impl SubsetOf<WideF32x8> for i32

source§

impl SubsetOf<WideF32x8> for i64

source§

impl SubsetOf<WideF32x8> for isize

source§

impl SubsetOf<WideF32x8> for u8

source§

impl SubsetOf<WideF32x8> for u16

source§

impl SubsetOf<WideF32x8> for u32

source§

impl SubsetOf<WideF32x8> for u64

source§

impl SubsetOf<WideF32x8> for usize

source§

impl SubsetOf<WideF64x4> for f32

source§

impl SubsetOf<WideF64x4> for f64

source§

impl SubsetOf<WideF64x4> for i8

source§

impl SubsetOf<WideF64x4> for i16

source§

impl SubsetOf<WideF64x4> for i32

source§

impl SubsetOf<WideF64x4> for i64

source§

impl SubsetOf<WideF64x4> for isize

source§

impl SubsetOf<WideF64x4> for u8

source§

impl SubsetOf<WideF64x4> for u16

source§

impl SubsetOf<WideF64x4> for u32

source§

impl SubsetOf<WideF64x4> for u64

source§

impl SubsetOf<WideF64x4> for usize

source§

impl<N1, N2: SupersetOf<N1>> SubsetOf<Complex<N2>> for Complex<N1>

source§

impl<N2> SubsetOf<AutoSimd<N2>> for f32

source§

impl<N2> SubsetOf<AutoSimd<N2>> for f64

source§

impl<N2> SubsetOf<AutoSimd<N2>> for i8

source§

impl<N2> SubsetOf<AutoSimd<N2>> for i16

source§

impl<N2> SubsetOf<AutoSimd<N2>> for i32

source§

impl<N2> SubsetOf<AutoSimd<N2>> for i64

source§

impl<N2> SubsetOf<AutoSimd<N2>> for isize

source§

impl<N2> SubsetOf<AutoSimd<N2>> for u8

source§

impl<N2> SubsetOf<AutoSimd<N2>> for u16

source§

impl<N2> SubsetOf<AutoSimd<N2>> for u32

source§

impl<N2> SubsetOf<AutoSimd<N2>> for u64

source§

impl<N2> SubsetOf<AutoSimd<N2>> for usize

source§

impl<N2: Zero + SupersetOf<f32>> SubsetOf<Complex<N2>> for f32

source§

impl<N2: Zero + SupersetOf<f64>> SubsetOf<Complex<N2>> for f64

source§

impl<N2: Zero + SupersetOf<i8>> SubsetOf<Complex<N2>> for i8

source§

impl<N2: Zero + SupersetOf<i16>> SubsetOf<Complex<N2>> for i16

source§

impl<N2: Zero + SupersetOf<i32>> SubsetOf<Complex<N2>> for i32

source§

impl<N2: Zero + SupersetOf<i64>> SubsetOf<Complex<N2>> for i64

source§

impl<N2: Zero + SupersetOf<i128>> SubsetOf<Complex<N2>> for i128

source§

impl<N2: Zero + SupersetOf<isize>> SubsetOf<Complex<N2>> for isize

source§

impl<N2: Zero + SupersetOf<u8>> SubsetOf<Complex<N2>> for u8

source§

impl<N2: Zero + SupersetOf<u16>> SubsetOf<Complex<N2>> for u16

source§

impl<N2: Zero + SupersetOf<u32>> SubsetOf<Complex<N2>> for u32

source§

impl<N2: Zero + SupersetOf<u64>> SubsetOf<Complex<N2>> for u64

source§

impl<N2: Zero + SupersetOf<u128>> SubsetOf<Complex<N2>> for u128

source§

impl<N2: Zero + SupersetOf<usize>> SubsetOf<Complex<N2>> for usize

Implementors§

source§

impl SubsetOf<AutoSimd<[f32; 2]>> for AutoSimd<[f32; 2]>

source§

impl SubsetOf<AutoSimd<[f32; 4]>> for AutoSimd<[f32; 4]>

source§

impl SubsetOf<AutoSimd<[f32; 8]>> for AutoSimd<[f32; 8]>

source§

impl SubsetOf<AutoSimd<[f32; 16]>> for AutoSimd<[f32; 16]>

source§

impl SubsetOf<AutoSimd<[f64; 2]>> for AutoSimd<[f64; 2]>

source§

impl SubsetOf<AutoSimd<[f64; 4]>> for AutoSimd<[f64; 4]>

source§

impl SubsetOf<AutoSimd<[f64; 8]>> for AutoSimd<[f64; 8]>

source§

impl SubsetOf<AutoSimd<[i8; 2]>> for AutoSimd<[i8; 2]>

source§

impl SubsetOf<AutoSimd<[i8; 4]>> for AutoSimd<[i8; 4]>

source§

impl SubsetOf<AutoSimd<[i8; 8]>> for AutoSimd<[i8; 8]>

source§

impl SubsetOf<AutoSimd<[i8; 16]>> for AutoSimd<[i8; 16]>

source§

impl SubsetOf<AutoSimd<[i8; 32]>> for AutoSimd<[i8; 32]>

source§

impl SubsetOf<AutoSimd<[i16; 2]>> for AutoSimd<[i16; 2]>

source§

impl SubsetOf<AutoSimd<[i16; 4]>> for AutoSimd<[i16; 4]>

source§

impl SubsetOf<AutoSimd<[i16; 8]>> for AutoSimd<[i16; 8]>

source§

impl SubsetOf<AutoSimd<[i16; 16]>> for AutoSimd<[i16; 16]>

source§

impl SubsetOf<AutoSimd<[i16; 32]>> for AutoSimd<[i16; 32]>

source§

impl SubsetOf<AutoSimd<[i32; 2]>> for AutoSimd<[i32; 2]>

source§

impl SubsetOf<AutoSimd<[i32; 4]>> for AutoSimd<[i32; 4]>

source§

impl SubsetOf<AutoSimd<[i32; 8]>> for AutoSimd<[i32; 8]>

source§

impl SubsetOf<AutoSimd<[i32; 16]>> for AutoSimd<[i32; 16]>

source§

impl SubsetOf<AutoSimd<[i64; 2]>> for AutoSimd<[i64; 2]>

source§

impl SubsetOf<AutoSimd<[i64; 4]>> for AutoSimd<[i64; 4]>

source§

impl SubsetOf<AutoSimd<[i64; 8]>> for AutoSimd<[i64; 8]>

source§

impl SubsetOf<AutoSimd<[i128; 1]>> for AutoSimd<[i128; 1]>

source§

impl SubsetOf<AutoSimd<[i128; 2]>> for AutoSimd<[i128; 2]>

source§

impl SubsetOf<AutoSimd<[i128; 4]>> for AutoSimd<[i128; 4]>

source§

impl SubsetOf<AutoSimd<[isize; 2]>> for AutoSimd<[isize; 2]>

source§

impl SubsetOf<AutoSimd<[isize; 4]>> for AutoSimd<[isize; 4]>

source§

impl SubsetOf<AutoSimd<[isize; 8]>> for AutoSimd<[isize; 8]>

source§

impl SubsetOf<AutoSimd<[u8; 2]>> for AutoSimd<[u8; 2]>

source§

impl SubsetOf<AutoSimd<[u8; 4]>> for AutoSimd<[u8; 4]>

source§

impl SubsetOf<AutoSimd<[u8; 8]>> for AutoSimd<[u8; 8]>

source§

impl SubsetOf<AutoSimd<[u8; 16]>> for AutoSimd<[u8; 16]>

source§

impl SubsetOf<AutoSimd<[u8; 32]>> for AutoSimd<[u8; 32]>

source§

impl SubsetOf<AutoSimd<[u16; 2]>> for AutoSimd<[u16; 2]>

source§

impl SubsetOf<AutoSimd<[u16; 4]>> for AutoSimd<[u16; 4]>

source§

impl SubsetOf<AutoSimd<[u16; 8]>> for AutoSimd<[u16; 8]>

source§

impl SubsetOf<AutoSimd<[u16; 16]>> for AutoSimd<[u16; 16]>

source§

impl SubsetOf<AutoSimd<[u16; 32]>> for AutoSimd<[u16; 32]>

source§

impl SubsetOf<AutoSimd<[u32; 2]>> for AutoSimd<[u32; 2]>

source§

impl SubsetOf<AutoSimd<[u32; 4]>> for AutoSimd<[u32; 4]>

source§

impl SubsetOf<AutoSimd<[u32; 8]>> for AutoSimd<[u32; 8]>

source§

impl SubsetOf<AutoSimd<[u32; 16]>> for AutoSimd<[u32; 16]>

source§

impl SubsetOf<AutoSimd<[u64; 2]>> for AutoSimd<[u64; 2]>

source§

impl SubsetOf<AutoSimd<[u64; 4]>> for AutoSimd<[u64; 4]>

source§

impl SubsetOf<AutoSimd<[u64; 8]>> for AutoSimd<[u64; 8]>

source§

impl SubsetOf<AutoSimd<[u128; 1]>> for AutoSimd<[u128; 1]>

source§

impl SubsetOf<AutoSimd<[u128; 2]>> for AutoSimd<[u128; 2]>

source§

impl SubsetOf<AutoSimd<[u128; 4]>> for AutoSimd<[u128; 4]>

source§

impl SubsetOf<AutoSimd<[usize; 2]>> for AutoSimd<[usize; 2]>

source§

impl SubsetOf<AutoSimd<[usize; 4]>> for AutoSimd<[usize; 4]>

source§

impl SubsetOf<AutoSimd<[usize; 8]>> for AutoSimd<[usize; 8]>

source§

impl SubsetOf<WideBoolF32x4> for WideBoolF32x4

source§

impl SubsetOf<WideBoolF32x8> for WideBoolF32x8

source§

impl SubsetOf<WideBoolF64x4> for WideBoolF64x4

source§

impl SubsetOf<WideF32x4> for WideF32x4

source§

impl SubsetOf<WideF32x8> for WideF32x8

source§

impl SubsetOf<WideF64x4> for WideF64x4