[][src]Trait alga::general::SubsetOf

pub trait SubsetOf<T>: Sized {
    fn to_superset(&self) -> T;
unsafe fn from_superset_unchecked(element: &T) -> Self;
fn is_in_subset(element: &T) -> bool; fn from_superset(element: &T) -> Option<Self> { ... } }

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:

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 limintations are important, other crates allowing you to query the limitations of given types should be used.

Required Methods

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

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

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

Provided Methods

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.

Implementations on Foreign Types

impl SubsetOf<u8> for u8
[src]

impl SubsetOf<u16> for u8
[src]

impl SubsetOf<u32> for u8
[src]

impl SubsetOf<u64> for u8
[src]

impl SubsetOf<usize> for u8
[src]

impl SubsetOf<i8> for u8
[src]

impl SubsetOf<i16> for u8
[src]

impl SubsetOf<i32> for u8
[src]

impl SubsetOf<i64> for u8
[src]

impl SubsetOf<isize> for u8
[src]

impl SubsetOf<f32> for u8
[src]

impl SubsetOf<f64> for u8
[src]

impl SubsetOf<u8> for u16
[src]

impl SubsetOf<u16> for u16
[src]

impl SubsetOf<u32> for u16
[src]

impl SubsetOf<u64> for u16
[src]

impl SubsetOf<usize> for u16
[src]

impl SubsetOf<i8> for u16
[src]

impl SubsetOf<i16> for u16
[src]

impl SubsetOf<i32> for u16
[src]

impl SubsetOf<i64> for u16
[src]

impl SubsetOf<isize> for u16
[src]

impl SubsetOf<f32> for u16
[src]

impl SubsetOf<f64> for u16
[src]

impl SubsetOf<u8> for u32
[src]

impl SubsetOf<u16> for u32
[src]

impl SubsetOf<u32> for u32
[src]

impl SubsetOf<u64> for u32
[src]

impl SubsetOf<usize> for u32
[src]

impl SubsetOf<i8> for u32
[src]

impl SubsetOf<i16> for u32
[src]

impl SubsetOf<i32> for u32
[src]

impl SubsetOf<i64> for u32
[src]

impl SubsetOf<isize> for u32
[src]

impl SubsetOf<f32> for u32
[src]

impl SubsetOf<f64> for u32
[src]

impl SubsetOf<u8> for u64
[src]

impl SubsetOf<u16> for u64
[src]

impl SubsetOf<u32> for u64
[src]

impl SubsetOf<u64> for u64
[src]

impl SubsetOf<usize> for u64
[src]

impl SubsetOf<i8> for u64
[src]

impl SubsetOf<i16> for u64
[src]

impl SubsetOf<i32> for u64
[src]

impl SubsetOf<i64> for u64
[src]

impl SubsetOf<isize> for u64
[src]

impl SubsetOf<f32> for u64
[src]

impl SubsetOf<f64> for u64
[src]

impl SubsetOf<u8> for usize
[src]

impl SubsetOf<u16> for usize
[src]

impl SubsetOf<u32> for usize
[src]

impl SubsetOf<u64> for usize
[src]

impl SubsetOf<usize> for usize
[src]

impl SubsetOf<i8> for usize
[src]

impl SubsetOf<i16> for usize
[src]

impl SubsetOf<i32> for usize
[src]

impl SubsetOf<i64> for usize
[src]

impl SubsetOf<isize> for usize
[src]

impl SubsetOf<f32> for usize
[src]

impl SubsetOf<f64> for usize
[src]

impl SubsetOf<i8> for i8
[src]

impl SubsetOf<i16> for i8
[src]

impl SubsetOf<i32> for i8
[src]

impl SubsetOf<i64> for i8
[src]

impl SubsetOf<isize> for i8
[src]

impl SubsetOf<f32> for i8
[src]

impl SubsetOf<f64> for i8
[src]

impl SubsetOf<i8> for i16
[src]

impl SubsetOf<i16> for i16
[src]

impl SubsetOf<i32> for i16
[src]

impl SubsetOf<i64> for i16
[src]

impl SubsetOf<isize> for i16
[src]

impl SubsetOf<f32> for i16
[src]

impl SubsetOf<f64> for i16
[src]

impl SubsetOf<i8> for i32
[src]

impl SubsetOf<i16> for i32
[src]

impl SubsetOf<i32> for i32
[src]

impl SubsetOf<i64> for i32
[src]

impl SubsetOf<isize> for i32
[src]

impl SubsetOf<f32> for i32
[src]

impl SubsetOf<f64> for i32
[src]

impl SubsetOf<i8> for i64
[src]

impl SubsetOf<i16> for i64
[src]

impl SubsetOf<i32> for i64
[src]

impl SubsetOf<i64> for i64
[src]

impl SubsetOf<isize> for i64
[src]

impl SubsetOf<f32> for i64
[src]

impl SubsetOf<f64> for i64
[src]

impl SubsetOf<i8> for isize
[src]

impl SubsetOf<i16> for isize
[src]

impl SubsetOf<i32> for isize
[src]

impl SubsetOf<i64> for isize
[src]

impl SubsetOf<isize> for isize
[src]

impl SubsetOf<f32> for isize
[src]

impl SubsetOf<f64> for isize
[src]

impl SubsetOf<f32> for f32
[src]

impl SubsetOf<f64> for f32
[src]

impl SubsetOf<f32> for f64
[src]

impl SubsetOf<f64> for f64
[src]

impl<N1, N2: SupersetOf<N1>> SubsetOf<Complex<N2>> for Complex<N1>
[src]

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

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

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

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

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

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

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

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

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

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

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

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

Implementors

impl<O: Operator, T: PartialEq + Identity<O>> SubsetOf<T> for Id<O>
[src]