Skip to main content

TotalRangeExt

Trait TotalRangeExt 

Source
pub trait TotalRangeExt<T: TotalFloat> {
    // Required methods
    fn into_primitive_range(self) -> RangeInclusive<T>;
    fn into_primitive_inner(self) -> (T, T);
}
Expand description

Extension trait for converting an inclusive Total range into an inclusive primitive range (or a (start, end) primitive tuple).

Required Methods§

Source

fn into_primitive_range(self) -> RangeInclusive<T>

Converts an inclusive Total range into an inclusive primitive range.

“Primitive” here means Rust’s built-in float type (e.g. f64).

This is the reverse of Total::from_primitive_range.

§Examples
use range_set_blaze::TotalF64;
use range_set_blaze::total::TotalRangeExt;

let range = TotalF64::new(3.0)..=TotalF64::new(5.0);
assert_eq!(range.into_primitive_range(), 3.0..=5.0);
Source

fn into_primitive_inner(self) -> (T, T)

Converts an inclusive Total range into a (start, end) tuple of primitive values.

“Primitive” here means Rust’s built-in float type (e.g. f64).

Mirrors RangeInclusive::into_inner from the standard library, which unwraps a range into its (start, end) tuple; this additionally converts each endpoint to its primitive type.

§Examples
use range_set_blaze::TotalF64;
use range_set_blaze::total::TotalRangeExt;

let range = TotalF64::new(3.0)..=TotalF64::new(5.0);
assert_eq!(range.into_primitive_inner(), (3.0, 5.0));

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: TotalFloat> TotalRangeExt<T> for RangeInclusive<Total<T>>

Implementors§