Interval

Enum Interval 

Source
pub enum Interval<T>
where T: PartialOrd,
{ TwoSided(T, T), UpperOneSided(T), LowerOneSided(T), }
Expand description

Interval over a partially ordered type (NB: floating point numbers are only partially ordered because of NaN values). The interval is defined by its lower and upper bounds. One-sided intervals (with a single concrete bound) are also supported. In this crate, intervals are considered inclusive of their (finite) bounds.

§Type parameters

  • T: The type over which the interval is defined. It must be partially ordered.

§Variants

  • TwoSided(T, T): Two-sided interval with lower and upper bounds. The interval is defined as [low, high]. The bounds are included in the interval.
  • UpperOneSided(T): Upper one-sided interval with a lower bound. The interval is defined as [low, +∞). The lower bound is included in the interval.
  • LowerOneSided(T): Lower one-sided interval with an upper bound. The interval is defined as (-∞, high]. The upper bound is included in the interval.

Intervals support various operations that depend on the type T over which they are defined.

§Operations

§Creation

§Accessors

  • Self::low(): Get the lower bound of the interval (if any) for partially ordered types.
  • Self::high(): Get the upper bound of the interval (if any) for partially ordered types.
  • Self::low_f(): Get the lower bound of the interval (if any) for floating point types.
  • Self::high_f(): Get the upper bound of the interval (if any) for floating point types.
  • Self::low_i(): Get the lower bound of the interval (if any) for signed integer types.
  • Self::high_i(): Get the upper bound of the interval (if any) for signed integer types.
  • Self::low_u(): Get the lower bound of the interval (if any) for unsigned integer types.
  • Self::high_u(): Get the upper bound of the interval (if any) for unsigned integer types.
  • Self::low_as_ref(): Get a reference to the lower bound of the interval (if any).
  • Self::high_as_ref(): Get a reference to the upper bound of the interval (if any).
  • Self::left(): Get the left bound of the interval (if any).
  • Self::right(): Get the right bound of the interval (if any).

§Characteristics

§Comparison

§Operators with a scalar value

§Operators with another interval

  • Self::relative_to(reference): Given two intervals, compute the relative interval compared to the reference (argument). The relative interval is defined as the interval of the ratios of the two intervals.

§Conversions

  • Self::try_from(value): Create a new interval from a tuple of bounds. The first element of the tuple is the lower bound, the second element is the upper bound. If the lower bound is greater than the upper bound, an error is returned.
  • Self::from(range): Create a new interval from a range. The range must be bounded. If the lower bound is greater than the upper bound, an error is returned.

§Display

§Examples

§Creation

use stats_ci::*;
let interval = Interval::new(0., 10.)?;
let interval = Interval::new_upper(0.);
let interval = Interval::new_lower(10.);

§Accessors

let interval = Interval::new(0., 10.)?;
assert_eq!(interval.low(), Some(0.));
assert_eq!(interval.high(), Some(10.));
assert_eq!(interval.low_f(), 0.);
assert_eq!(interval.high_f(), 10.);
assert_eq!(interval.width(), Some(10.));
assert_eq!(interval.is_one_sided(), false);
assert_eq!(interval.is_two_sided(), true);
assert_eq!(interval.is_upper(), false);
assert_eq!(interval.is_lower(), false);
assert_eq!(interval.is_degenerate(), false);

§Comparison

let interval = Interval::new(0., 10.)?;
let interval2 = Interval::new(8., 15.)?;
let interval3 = Interval::new(2., 5.)?;
assert!(interval.intersects(&interval2));
assert!(interval3.is_included_in(&interval));
assert!(interval.includes(&interval3));
assert!(interval3 < interval2);
assert!(interval == Interval::new(0., 10.)?);
assert!(interval.contains(&5.));
assert!(!interval.contains(&20.));

§Operations

let interval = Interval::new(2., 4.)?;
assert_eq!(interval * 2., Interval::new(4., 8.)?);
assert_eq!(interval + 2., Interval::new(4., 6.)?);
assert_eq!(interval - 2., Interval::new(0., 2.)?);
assert_eq!(interval / 2., Interval::new(1., 2.)?);

§Conversions

let interval = Interval::new(2., 4.)?;
assert_eq!(interval, Interval::try_from(2. ..= 4.)?);
assert_eq!(interval, Interval::try_from((2., 4.))?);
assert_eq!(interval, Interval::try_from((Some(2.), Some(4.)))?);
assert_eq!(Interval::from(..= 10.), Interval::new_lower(10.));
assert_eq!(Interval::from(2. ..), Interval::new_upper(2.));
assert_eq!(format!("{}", interval), String::from("[2, 4]"));
assert_eq!(format!("{}", Interval::new_lower(3.)), String::from("(<-,3]"));
assert_eq!(format!("{}", Interval::new_upper(2.)), String::from("[2,->)"));

Variants§

§

TwoSided(T, T)

Two-sided interval with lower and upper bounds. The interval is defined as [low, high]. The bounds are included in the interval.

§

UpperOneSided(T)

Upper one-sided interval with a lower bound. The interval is defined as [low, +∞). The lower bound is included in the interval.

§

LowerOneSided(T)

Lower one-sided interval with an upper bound. The interval is defined as (-∞, high]. The upper bound is included in the interval.

Implementations§

Source§

impl<T: PartialOrd> Interval<T>

Source

pub fn new(low: T, high: T) -> Result<Self, IntervalError>

Create a new interval from its left and right bounds for ordered types with equality.

§Examples
let interval = Interval::new(0., 1.)?;
assert_eq!(interval.low(), Some(0.));
assert_eq!(interval.high(), Some(1.));
let interval2 = Interval::new("A", "Z")?;
assert_eq!(interval2.low(), Some("A"));
assert_eq!(interval2.high(), Some("Z"));
let interval3 = Interval::new(0, 0_usize)?;
assert_eq!(interval3.low(), Some(0));
assert_eq!(interval3.high(), Some(0));
Source

pub fn new_upper(low: T) -> Self

Create a new upper one-sided interval from its left bound. The interval is defined as [low, +∞). The bound is included in the interval.

§Examples

The interval below represents [0., +∞).

let interval = Interval::new_upper(0.);
assert_eq!(interval.low(), Some(0.));
assert_eq!(interval.high(), None);
Source

pub fn new_lower(high: T) -> Self

Create a new lower one-sided interval from its right bound. The interval is defined as (-∞, high]. The bound is included in the interval.

§Examples

The interval below represents (-∞, 1.]

let interval = Interval::new_lower(1.);
assert_eq!(interval.low(), None);
assert_eq!(interval.high(), Some(1.));
Source

pub fn is_two_sided(&self) -> bool

Test whether the interval is two-sided.

Source

pub fn is_one_sided(&self) -> bool

Test whether the interval is one-sided.

Source

pub fn is_upper(&self) -> bool

Test whether the interval is an upper one-sided interval.

Source

pub fn is_lower(&self) -> bool

Test whether the interval is a lower one-sided interval.

Source

pub fn contains(&self, x: &T) -> bool

Test whether the interval contains a value.

§Examples
let interval = Interval::new(0., 1.)?;
assert!(interval.contains(&0.5));
assert!(!interval.contains(&2.));
Source

pub fn intersects(&self, other: &Self) -> bool

Test whether the interval intersects another interval. Two intervals are considered to intersect even if they only have a single point in common (e.g., one of their bounds).

§Examples
let interval = Interval::new(0., 1.)?;
let interval2 = Interval::new(0.5, 1.5)?;
assert!(interval.intersects(&interval2));
let interval3 = Interval::new(2., 3.)?;
assert!(!interval.intersects(&interval3));
Source

pub fn is_included_in(&self, other: &Self) -> bool

Test whether the interval is included in another interval.

The inclusion is not strict, i.e. an interval is included in itself.

Source

pub fn includes(&self, other: &Self) -> bool

Test whether the interval includes another interval.

The inclusion is not strict, i.e. an interval includes itself.

Source

pub fn left(&self) -> Option<&T>

Get the left bound of the interval (if any).

Source

pub fn right(&self) -> Option<&T>

Get the right bound of the interval (if any).

Source§

impl<T: PartialOrd + PartialEq> Interval<T>

Source

pub fn is_degenerate(&self) -> bool

Test whether the interval is degenerate. A degenerate interval is an interval with a single point. For example, the interval [0, 0] is degenerate.

Source§

impl<T: PartialOrd + Clone> Interval<T>

Source

pub fn low(&self) -> Option<T>

Get the lower bound of the interval (if any) for partially ordered types.

This function clones the bound. If cloning is an issue, use Self::low_as_ref() instead.

Source

pub fn high(&self) -> Option<T>

Get the upper bound of the interval (if any) for partially ordered types.

This function clones the bound. If cloning is an issue, use Self::high_as_ref() instead.

Source§

impl<T: Float> Interval<T>

Source

pub fn low_f(&self) -> T

Get the lower bound of the interval (if any) for floating point types. This function returns the negative infinite value for T for lower one-sided intervals.

Source

pub fn high_f(&self) -> T

Get the upper bound of the interval (if any) for floating point types. This function returns the infinite value for T for upper one-sided intervals.

Source

pub fn relative_to(&self, reference: &Interval<T>) -> Interval<T>

Given two intervals, compute the relative interval compared to the reference (argument). The relative interval is defined as the interval of the ratios of the two intervals.

E.g., for two two-sided intervals \( [x, y] \) and reference \( [a, b] \), the relative interval is \( [(x-b)/b, (y-a)/a] \).

Source§

impl<T: PrimInt + Signed> Interval<T>

Source

pub fn low_i(&self) -> T

Get the lower bound of the interval (if any) for signed integer types. This function returns the minimal value for T for lower one-sided intervals.

Source

pub fn high_i(&self) -> T

Get the upper bound of the interval (if any) for signed integer types. This function returns the maximal value for T for upper one-sided intervals.

Source§

impl<T: PrimInt + Unsigned> Interval<T>

Source

pub fn low_u(&self) -> T

Get the lower bound of the interval (if any) for unsigned integer types. This function returns 0 for lower one-sided intervals.

Source

pub fn high_u(&self) -> T

Get the upper bound of the interval (if any) for unsigned integer types. This function returns the maximum value for T for upper one-sided intervals.

Source§

impl<T: PartialOrd> Interval<T>

Source

pub fn low_as_ref(&self) -> Option<&T>

Get a reference to the lower bound of the interval (if any).

See also Self::low() if cloning is not an issue.

Source

pub fn high_as_ref(&self) -> Option<&T>

Get a reference to the upper bound of the interval (if any).

See also Self::high() if cloning is not an issue.

Source§

impl<T: PartialOrd + Sub<Output = T> + Zero + Clone> Interval<T>

Source

pub fn width(&self) -> Option<T>

Compute the width of the interval. If the interval is one-sided, the function returns None.

Trait Implementations§

Source§

impl<T: AbsDiffEq + PartialOrd> AbsDiffEq for Interval<T>
where T::Epsilon: Copy,

Available on crate feature approx only.
Source§

type Epsilon = <T as AbsDiffEq>::Epsilon

Used for specifying relative comparisons.
Source§

fn default_epsilon() -> T::Epsilon

The default tolerance to use when testing values that are close together. Read more
Source§

fn abs_diff_eq(&self, other: &Self, epsilon: T::Epsilon) -> bool

A test for equality that uses the absolute difference to compute the approximate equality of two numbers.
Source§

fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool

The inverse of AbsDiffEq::abs_diff_eq.
Source§

impl<F: Add<F, Output = F> + PartialOrd + Copy> Add<F> for Interval<F>

Source§

type Output = Interval<F>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: F) -> Self::Output

Performs the + operation. Read more
Source§

impl<F: Num + PartialOrd + Copy> Add for Interval<F>

Source§

type Output = Interval<F>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<T: PartialOrd> AsRef<Interval<T>> for Interval<T>

Source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: PartialOrd + Clone> Clone for Interval<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for Interval<T>
where T: PartialOrd + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: PartialOrd + Display> Display for Interval<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<F: Div<F, Output = F> + PartialOrd + Copy> Div<F> for Interval<F>

Source§

type Output = Interval<F>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: F) -> Self::Output

Performs the / operation. Read more
Source§

impl<T: PartialOrd + Clone> From<Interval<T>> for (Option<T>, Option<T>)

Source§

fn from(interval: Interval<T>) -> Self

Convert an interval to a tuple of optional bounds. The first element of the tuple is the lower bound, the second element is the upper bound. If the interval is one-sided, one of the bounds is None,

Source§

impl From<Interval<f32>> for (f32, f32)

Source§

fn from(value: Interval<f32>) -> Self

Converts to this type from the input type.
Source§

impl From<Interval<f64>> for (f64, f64)

Source§

fn from(value: Interval<f64>) -> Self

Converts to this type from the input type.
Source§

impl From<Interval<i128>> for (i128, i128)

Source§

fn from(value: Interval<i128>) -> Self

Converts to this type from the input type.
Source§

impl From<Interval<i16>> for (i16, i16)

Source§

fn from(value: Interval<i16>) -> Self

Converts to this type from the input type.
Source§

impl From<Interval<i32>> for (i32, i32)

Source§

fn from(value: Interval<i32>) -> Self

Converts to this type from the input type.
Source§

impl From<Interval<i64>> for (i64, i64)

Source§

fn from(value: Interval<i64>) -> Self

Converts to this type from the input type.
Source§

impl From<Interval<i8>> for (i8, i8)

Source§

fn from(value: Interval<i8>) -> Self

Converts to this type from the input type.
Source§

impl From<Interval<isize>> for (isize, isize)

Source§

fn from(value: Interval<isize>) -> Self

Converts to this type from the input type.
Source§

impl From<Interval<u128>> for (u128, u128)

Source§

fn from(value: Interval<u128>) -> Self

Converts to this type from the input type.
Source§

impl From<Interval<u16>> for (u16, u16)

Source§

fn from(value: Interval<u16>) -> Self

Converts to this type from the input type.
Source§

impl From<Interval<u32>> for (u32, u32)

Source§

fn from(value: Interval<u32>) -> Self

Converts to this type from the input type.
Source§

impl From<Interval<u64>> for (u64, u64)

Source§

fn from(value: Interval<u64>) -> Self

Converts to this type from the input type.
Source§

impl From<Interval<u8>> for (u8, u8)

Source§

fn from(value: Interval<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<Interval<usize>> for (usize, usize)

Source§

fn from(value: Interval<usize>) -> Self

Converts to this type from the input type.
Source§

impl<T: PartialOrd> From<RangeFrom<T>> for Interval<T>

Source§

fn from(range: RangeFrom<T>) -> Self

Create an upper one-sided interval from a range starting from a given value.

use stats_ci::Interval;
use std::ops::RangeFrom;
let interval = Interval::from(1..);
assert_eq!(interval, Interval::new_upper(1));
Source§

impl<T: PartialOrd> From<RangeToInclusive<T>> for Interval<T>

Source§

fn from(range: RangeToInclusive<T>) -> Self

Create a lower one-sided interval from a range ending at a given value.

use stats_ci::Interval;
use std::ops::RangeToInclusive;
let interval = Interval::from(..=1);
assert_eq!(interval, Interval::new_lower(1));
Source§

impl<T: PartialOrd + Hash> Hash for Interval<T>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

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

impl<F: Mul<F, Output = F> + PartialOrd + Copy> Mul<F> for Interval<F>

Source§

type Output = Interval<F>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: F) -> Self::Output

Performs the * operation. Read more
Source§

impl<F: Neg<Output = F> + PartialOrd + Copy> Neg for Interval<F>

Source§

type Output = Interval<F>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<T> PartialEq for Interval<T>
where T: PartialOrd + PartialEq,

Source§

fn eq(&self, other: &Interval<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialOrd> PartialOrd for Interval<T>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

Compare two intervals. Given two intervals a and b, a < b if and only if the upper bound of a is less than the lower bound of b. Although interval bounds are inclusive, two intervals that overlap only at a single bound are considered ordered. E.g., intervals [x,y] is considered less than [a,b] if y==a and x<b.

§Examples
let a = Interval::new(0, 10)?;
let b = Interval::new(10, 20)?;
let c = Interval::new(11, 20)?;
let d = Interval::new(0, 10)?;
let e = Interval::new_upper(10);
assert_eq!(a.partial_cmp(&b), Some(Ordering::Less));
assert_eq!(a.partial_cmp(&c), Some(Ordering::Less));
assert_eq!(a.partial_cmp(&d), Some(Ordering::Equal));
assert_eq!(a.partial_cmp(&e), Some(Ordering::Less));
assert_eq!(c.partial_cmp(&a), Some(Ordering::Greater));
assert_eq!(b.partial_cmp(&c), None);
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T: PartialOrd> RangeBounds<T> for Interval<T>

Source§

fn start_bound(&self) -> Bound<&T>

Start index bound. Read more
Source§

fn end_bound(&self) -> Bound<&T>

End index bound. Read more
1.35.0 · Source§

fn contains<U>(&self, item: &U) -> bool
where T: PartialOrd<U>, U: PartialOrd<T> + ?Sized,

Returns true if item is contained in the range. Read more
Source§

fn is_empty(&self) -> bool
where T: PartialOrd,

🔬This is a nightly-only experimental API. (range_bounds_is_empty)
Returns true if the range contains no items. One-sided ranges (RangeFrom, etc) always return false. Read more
Source§

impl<T: RelativeEq + PartialOrd> RelativeEq for Interval<T>
where T::Epsilon: Copy,

Available on crate feature approx only.
Source§

fn default_max_relative() -> T::Epsilon

The default relative tolerance for testing values that are far-apart. Read more
Source§

fn relative_eq( &self, other: &Self, epsilon: T::Epsilon, max_relative: T::Epsilon, ) -> bool

A test for equality that uses a relative comparison if the values are far apart.
Source§

fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

The inverse of RelativeEq::relative_eq.
Source§

impl<F: Sub<F, Output = F> + PartialOrd + Copy> Sub<F> for Interval<F>

Source§

type Output = Interval<F>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: F) -> Self::Output

Performs the - operation. Read more
Source§

impl<F: Num + PartialOrd + Copy> Sub for Interval<F>

Source§

type Output = Interval<F>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<T: PartialOrd> TryFrom<(Option<T>, Option<T>)> for Interval<T>

Source§

fn try_from(value: (Option<T>, Option<T>)) -> Result<Self, Self::Error>

Create a new interval from a tuple of optional bounds. The first element of the tuple is the lower bound, the second element is the upper bound. If one of the bounds is None, the interval is one-sided. If both bounds are None, an error is returned.

Source§

type Error = IntervalError

The type returned in the event of a conversion error.
Source§

impl<T: PartialOrd> TryFrom<(T, T)> for Interval<T>

Source§

fn try_from(value: (T, T)) -> Result<Self, Self::Error>

Create a new interval from a tuple of bounds. The first element of the tuple is the lower bound, the second element is the upper bound. If the lower bound is greater than the upper bound, an error is returned.

Source§

type Error = IntervalError

The type returned in the event of a conversion error.
Source§

impl<T: PartialOrd> TryFrom<RangeInclusive<T>> for Interval<T>

Source§

fn try_from(range: RangeInclusive<T>) -> Result<Self, Self::Error>

Create an interval from an inclusive range. The range must be non-empty or the function will return an error.

use stats_ci::Interval;
use std::ops::RangeInclusive;
let interval = Interval::try_from(1..=2);
assert!(interval.is_ok());
assert_eq!(interval.unwrap(), Interval::new(1, 2).unwrap());
Source§

type Error = IntervalError

The type returned in the event of a conversion error.
Source§

impl<T: UlpsEq + PartialOrd> UlpsEq for Interval<T>
where T::Epsilon: Copy,

Available on crate feature approx only.
Source§

fn default_max_ulps() -> u32

The default ULPs to tolerate when testing values that are far-apart. Read more
Source§

fn ulps_eq(&self, other: &Self, epsilon: T::Epsilon, max_ulps: u32) -> bool

A test for equality that uses units in the last place (ULP) if the values are far apart.
Source§

fn ulps_ne(&self, other: &Rhs, epsilon: Self::Epsilon, max_ulps: u32) -> bool

The inverse of UlpsEq::ulps_eq.
Source§

impl<T: PartialOrd + Copy> Copy for Interval<T>

Source§

impl<T> StructuralPartialEq for Interval<T>
where T: PartialOrd,

Auto Trait Implementations§

§

impl<T> Freeze for Interval<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Interval<T>
where T: RefUnwindSafe,

§

impl<T> Send for Interval<T>
where T: Send,

§

impl<T> Sync for Interval<T>
where T: Sync,

§

impl<T> Unpin for Interval<T>
where T: Unpin,

§

impl<T> UnwindSafe for Interval<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

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

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

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

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ClosedNeg for T
where T: Neg<Output = T>,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,