Struct inari::Interval [−][src]
#[repr(C)]pub struct Interval { /* fields omitted */ }
Expand description
An interval with f64
bounds.
It is sometimes referred to as a bare interval in contrast to a decorated interval (DecInterval
).
Implementations
impl Interval
[src]
impl Interval
[src]impl Interval
[src]
impl Interval
[src]impl Interval
[src]
impl Interval
[src]pub fn contains(self, rhs: f64) -> bool
[src]
pub fn contains(self, rhs: f64) -> bool
[src]Returns true
if rhs
is a member of self
($\rhs β \self$).
If rhs
is not a real number, false
is returned.
Examples
use inari::*; assert!(const_interval!(1.0, 2.0).contains(1.0)); assert!(!Interval::EMPTY.contains(1.0)); assert!(Interval::ENTIRE.contains(1.0));
$Β±β$ and NaN are not real numbers, thus do not belong to any interval:
use inari::*; assert!(!Interval::ENTIRE.contains(f64::INFINITY)); assert!(!Interval::ENTIRE.contains(f64::NEG_INFINITY)); assert!(!Interval::ENTIRE.contains(f64::NAN));
pub fn disjoint(self, rhs: Self) -> bool
[src]
pub fn disjoint(self, rhs: Self) -> bool
[src]Returns true
if self
and rhs
are disjoint ($\self β© \rhs = β
$).
The formal definition is:
$$ βx β \self, βy β \rhs : x β y. $$
Examples
use inari::*; assert!(const_interval!(1.0, 2.0).disjoint(const_interval!(3.0, 4.0))); assert!(!const_interval!(1.0, 3.0).disjoint(const_interval!(3.0, 4.0))); assert!(!const_interval!(1.0, 5.0).disjoint(const_interval!(3.0, 4.0))); assert!(Interval::EMPTY.disjoint(Interval::EMPTY)); assert!(Interval::EMPTY.disjoint(Interval::ENTIRE));
pub fn interior(self, rhs: Self) -> bool
[src]
pub fn interior(self, rhs: Self) -> bool
[src]Returns true
if self
is interior to rhs
.
The formal definition is:
$$ (βx β \self, βy β \rhs : x < y) β§ (βx β \self, βy β \rhs : y < x). $$
Examples
use inari::*; assert!(const_interval!(1.1, 1.9).interior(const_interval!(1.0, 2.0))); assert!(!const_interval!(1.1, 2.0).interior(const_interval!(1.0, 2.0))); assert!(Interval::EMPTY.interior(Interval::EMPTY)); assert!(Interval::ENTIRE.interior(Interval::ENTIRE));
pub fn is_common_interval(self) -> bool
[src]
pub fn is_common_interval(self) -> bool
[src]Returns true
if self
is nonempty and bounded.
Examples
use inari::*; assert!(const_interval!(1.0, 2.0).is_common_interval()); assert!(!const_interval!(1.0, f64::INFINITY).is_common_interval()); assert!(!Interval::EMPTY.is_common_interval()); assert!(!Interval::ENTIRE.is_common_interval());
pub fn is_empty(self) -> bool
[src]
pub fn is_empty(self) -> bool
[src]Returns true
if self
is empty ($\self = β
$).
Examples
use inari::*; assert!(!const_interval!(1.0, 1.0).is_empty()); assert!(Interval::EMPTY.is_empty()); assert!(!Interval::ENTIRE.is_empty());
pub fn is_entire(self) -> bool
[src]
pub fn is_entire(self) -> bool
[src]Returns true
if $\self = [-β, +β]$.
Examples
use inari::*; assert!(!const_interval!(1.0, f64::INFINITY).is_entire()); assert!(!Interval::EMPTY.is_entire()); assert!(Interval::ENTIRE.is_entire());
pub fn is_singleton(self) -> bool
[src]
pub fn is_singleton(self) -> bool
[src]Returns true
if self
consists of a single real number.
Examples
use inari::*; assert!(const_interval!(1.0, 1.0).is_singleton()); assert!(!const_interval!(1.0, 2.0).is_singleton()); assert!(!Interval::EMPTY.is_singleton()); assert!(!Interval::ENTIRE.is_singleton());
0.1 is not a member of f64
:
use inari::*; // The singleton set that consists of the nearest `f64` number to 0.1. assert!(const_interval!(0.1, 0.1).is_singleton()); // The tightest interval that encloses 0.1. #[cfg(feature = "gmp")] assert!(!interval!("[0.1, 0.1]").unwrap().is_singleton());
pub fn less(self, rhs: Self) -> bool
[src]
pub fn less(self, rhs: Self) -> bool
[src]Returns true
if self
is weakly less than rhs
.
The formal definition is:
$$ (βx β \self, βy β \rhs : x β€ y) β§ (βy β \rhs, βx β \self : x β€ y). $$
Examples
use inari::*; assert!(const_interval!(1.0, 2.0).less(const_interval!(3.0, 4.0))); assert!(const_interval!(1.0, 3.0).less(const_interval!(2.0, 4.0))); assert!(const_interval!(1.0, 4.0).less(const_interval!(1.0, 4.0))); assert!(Interval::EMPTY.less(Interval::EMPTY)); assert!(!Interval::EMPTY.less(Interval::ENTIRE)); assert!(!Interval::ENTIRE.less(Interval::EMPTY)); assert!(Interval::ENTIRE.less(Interval::ENTIRE));
pub fn precedes(self, rhs: Self) -> bool
[src]
pub fn precedes(self, rhs: Self) -> bool
[src]Returns true
if self
is to the left of but may touch rhs
.
The formal definition is:
$$ βx β \self, βy β \rhs : x β€ y. $$
Examples
use inari::*; assert!(const_interval!(1.0, 2.0).precedes(const_interval!(3.0, 4.0))); assert!(const_interval!(1.0, 3.0).precedes(const_interval!(3.0, 4.0))); assert!(!const_interval!(1.0, 3.0).precedes(const_interval!(2.0, 4.0))); assert!(Interval::EMPTY.precedes(Interval::EMPTY)); assert!(Interval::EMPTY.precedes(Interval::ENTIRE)); assert!(Interval::ENTIRE.precedes(Interval::EMPTY)); assert!(!Interval::ENTIRE.precedes(Interval::ENTIRE));
pub fn strict_less(self, rhs: Self) -> bool
[src]
pub fn strict_less(self, rhs: Self) -> bool
[src]Returns true
if self
is strictly less than rhs
.
The formal definition is:
$$ (βx β \self, βy β \rhs : x < y) β§ (βy β \self, βx β \rhs : x < y). $$
Examples
use inari::*; assert!(const_interval!(1.0, 2.0).strict_less(const_interval!(3.0, 4.0))); assert!(const_interval!(1.0, 3.0).strict_less(const_interval!(2.0, 4.0))); assert!(!const_interval!(1.0, 4.0).strict_less(const_interval!(2.0, 4.0))); assert!(const_interval!(1.0, f64::INFINITY).strict_less(const_interval!(2.0, f64::INFINITY))); assert!(Interval::EMPTY.strict_less(Interval::EMPTY)); assert!(!Interval::EMPTY.strict_less(Interval::ENTIRE)); assert!(!Interval::ENTIRE.strict_less(Interval::EMPTY)); assert!(Interval::ENTIRE.strict_less(Interval::ENTIRE));
pub fn strict_precedes(self, rhs: Self) -> bool
[src]
pub fn strict_precedes(self, rhs: Self) -> bool
[src]Returns true
if self
is strictly to the left of rhs
.
The formal definition is:
$$ βx β \self, βy β \rhs : x < y. $$
pub fn subset(self, rhs: Self) -> bool
[src]
pub fn subset(self, rhs: Self) -> bool
[src]Returns true
if self
is a subset of rhs
($\self β \rhs$).
The formal definition is:
$$ βx β \self, βy β \rhs : x = y. $$
Examples
use inari::*; assert!(const_interval!(1.0, 2.0).subset(const_interval!(1.0, 2.0))); assert!(Interval::EMPTY.subset(Interval::EMPTY)); assert!(Interval::EMPTY.subset(Interval::ENTIRE)); assert!(Interval::ENTIRE.subset(Interval::ENTIRE));
impl Interval
[src]
impl Interval
[src]pub fn to_be_bytes(self) -> [u8; 16]
[src]
pub fn to_be_bytes(self) -> [u8; 16]
[src]Returns the interchange representation of the interval in the big-endian byte order.
pub fn to_le_bytes(self) -> [u8; 16]
[src]
pub fn to_le_bytes(self) -> [u8; 16]
[src]Returns the interchange representation of the interval in the little-endian byte order.
pub fn to_ne_bytes(self) -> [u8; 16]
[src]
pub fn to_ne_bytes(self) -> [u8; 16]
[src]Returns the interchange representation of the interval in the target platformβs native byte order.
pub fn try_from_be_bytes(bytes: [u8; 16]) -> Result<Self>
[src]
pub fn try_from_be_bytes(bytes: [u8; 16]) -> Result<Self>
[src]Creates an interval from its interchange representation in the big-endian byte order.
impl Interval
[src]
impl Interval
[src]pub const FRAC_1_SQRT_2: Self
[src]
pub const FRAC_1_SQRT_2: Self
[src]The tightest interval enclosing $1 / \sqrt{2}$.
pub const FRAC_2_SQRT_PI: Self
[src]
pub const FRAC_2_SQRT_PI: Self
[src]The tightest interval enclosing $2 / \sqrt{Ο}$.
impl Interval
[src]
impl Interval
[src]pub fn atan2(self, rhs: Self) -> Self
[src]
pub fn atan2(self, rhs: Self) -> Self
[src]Returns the angle of the point $(\rhs, \self)$ measured counterclockwise from the positive $x$-axis in the Euclidean $xy$-plane.
Tightness: tightest
pub fn pow(self, rhs: Self) -> Self
[src]
pub fn pow(self, rhs: Self) -> Self
[src]Returns self
raised to the power of rhs
.
Tightness: tightest
impl Interval
[src]
impl Interval
[src]pub fn ceil(self) -> Self
[src]
pub fn ceil(self) -> Self
[src]Rounds the bounds of self
to integers using directed rounding toward $+β$.
Tightness: tightest
Examples
use inari::*; assert_eq!(const_interval!(0.2, 1.2).ceil(), const_interval!(1.0, 2.0)); assert_eq!(const_interval!(0.8, 1.8).ceil(), const_interval!(1.0, 2.0)); assert_eq!(const_interval!(-1.2, -0.2).ceil(), const_interval!(-1.0, 0.0)); assert_eq!(const_interval!(-1.8, -0.8).ceil(), const_interval!(-1.0, 0.0)); assert_eq!(Interval::EMPTY.ceil(), Interval::EMPTY); assert_eq!(Interval::ENTIRE.ceil(), Interval::ENTIRE);
See also: Interval::floor
, Interval::trunc
.
pub fn floor(self) -> Self
[src]
pub fn floor(self) -> Self
[src]Rounds the bounds of self
to integers using directed rounding toward $-β$.
Tightness: tightest
Examples
use inari::*; assert_eq!(const_interval!(0.2, 1.2).floor(), const_interval!(0.0, 1.0)); assert_eq!(const_interval!(0.8, 1.8).floor(), const_interval!(0.0, 1.0)); assert_eq!(const_interval!(-1.2, -0.2).floor(), const_interval!(-2.0, -1.0)); assert_eq!(const_interval!(-1.8, -0.8).floor(), const_interval!(-2.0, -1.0)); assert_eq!(Interval::EMPTY.floor(), Interval::EMPTY); assert_eq!(Interval::ENTIRE.floor(), Interval::ENTIRE);
See also: Interval::ceil
, Interval::trunc
.
pub fn round(self) -> Self
[src]
pub fn round(self) -> Self
[src]Rounds the bounds of self
to the nearest integers,
with halfway cases rounded away from zero.
Tightness: tightest
Examples
use inari::*; assert_eq!(const_interval!(0.2, 1.2).round(), const_interval!(0.0, 1.0)); assert_eq!(const_interval!(0.5, 1.5).round(), const_interval!(1.0, 2.0)); assert_eq!(const_interval!(0.8, 1.8).round(), const_interval!(1.0, 2.0)); assert_eq!(const_interval!(-1.2, -0.2).round(), const_interval!(-1.0, 0.0)); assert_eq!(const_interval!(-1.5, -0.5).round(), const_interval!(-2.0, -1.0)); assert_eq!(const_interval!(-1.8, -0.8).round(), const_interval!(-2.0, -1.0)); assert_eq!(Interval::EMPTY.round(), Interval::EMPTY); assert_eq!(Interval::ENTIRE.round(), Interval::ENTIRE);
See also: Interval::round_ties_to_even
.
pub fn round_ties_to_even(self) -> Self
[src]
pub fn round_ties_to_even(self) -> Self
[src]Rounds the bounds of self
to the nearest integers,
with halfway cases rounded to even numbers.
Tightness: tightest
Examples
use inari::*; assert_eq!(const_interval!(0.2, 1.2).round_ties_to_even(), const_interval!(0.0, 1.0)); assert_eq!(const_interval!(0.5, 1.5).round_ties_to_even(), const_interval!(0.0, 2.0)); assert_eq!(const_interval!(0.8, 1.8).round_ties_to_even(), const_interval!(1.0, 2.0)); assert_eq!(const_interval!(-1.2, -0.2).round_ties_to_even(), const_interval!(-1.0, 0.0)); assert_eq!(const_interval!(-1.5, -0.5).round_ties_to_even(), const_interval!(-2.0, 0.0)); assert_eq!(const_interval!(-1.8, -0.8).round_ties_to_even(), const_interval!(-2.0, -1.0)); assert_eq!(Interval::EMPTY.round_ties_to_even(), Interval::EMPTY); assert_eq!(Interval::ENTIRE.round_ties_to_even(), Interval::ENTIRE);
See also: Interval::round
.
pub fn sign(self) -> Self
[src]
pub fn sign(self) -> Self
[src]Returns the sign of self
.
Note the difference between the sign function and f64::signum
; $\sgn(0)$ is always zero,
while the values of +0.0_f64.signum()
and -0.0_f64.signum()
are +1.0
and -1.0
, respectively.
Tightness: tightest
Examples
use inari::*; assert_eq!(const_interval!(-10.0, -0.1).sign(), const_interval!(-1.0, -1.0)); assert_eq!(const_interval!(0.0, 0.0).sign(), const_interval!(0.0, 0.0)); assert_eq!(const_interval!(0.1, 10.0).sign(), const_interval!(1.0, 1.0)); assert_eq!(Interval::EMPTY.sign(), Interval::EMPTY); assert_eq!(Interval::ENTIRE.sign(), const_interval!(-1.0, 1.0));
pub fn trunc(self) -> Self
[src]
pub fn trunc(self) -> Self
[src]Rounds the bounds of self
to integers using directed rounding toward zero.
Tightness: tightest
Examples
use inari::*; assert_eq!(const_interval!(0.2, 1.2).trunc(), const_interval!(0.0, 1.0)); assert_eq!(const_interval!(0.8, 1.8).trunc(), const_interval!(0.0, 1.0)); assert_eq!(const_interval!(-1.2, -0.2).trunc(), const_interval!(-1.0, 0.0)); assert_eq!(const_interval!(-1.8, -0.8).trunc(), const_interval!(-1.0, 0.0)); assert_eq!(Interval::EMPTY.trunc(), Interval::EMPTY); assert_eq!(Interval::ENTIRE.trunc(), Interval::ENTIRE);
See also: Interval::ceil
, Interval::floor
.
impl Interval
[src]
impl Interval
[src]pub fn inf(self) -> f64
[src]
pub fn inf(self) -> f64
[src]Returns the (greatest) lower bound of self
.
Equivalently, it returns $a$ if $\self = [a, b]$ is nonempty; otherwise, $+β$.
Examples
use inari::*; assert_eq!(const_interval!(-2.0, 3.0).inf(), -2.0); assert_eq!(Interval::EMPTY.inf(), f64::INFINITY); assert_eq!(Interval::ENTIRE.inf(), f64::NEG_INFINITY);
See also: Interval::sup
.
pub fn mag(self) -> f64
[src]
pub fn mag(self) -> f64
[src]Returns the magnitude of self
if self
is nonempty; otherwise, NaN.
The magnitude of a nonempty interval $π = [a, b]$ is defined as follows:
$$ \operatorname{mag}(π) = \sup\{|x| β£ x β π\} = \max(|a|, |b|). $$
Examples
use inari::*; assert_eq!(const_interval!(-2.0, 3.0).mag(), 3.0); assert!(Interval::EMPTY.mag().is_nan()); assert_eq!(Interval::ENTIRE.mag(), f64::INFINITY);
See also: Interval::mig
.
pub fn mid(self) -> f64
[src]
pub fn mid(self) -> f64
[src]Returns the midpoint of self
if self
is nonempty; otherwise, NaN.
For nonempty cases, the following values are returned.
- If $\self = [-β, +β]$, zero is returned.
- If $\self = [-β, b]$ where $b < +β$,
f64::MIN
is returned. - If $\self = [a, +β]$ where $a > -β$,
f64::MAX
is returned. - If
self
is bounded, $\operatorname{mid}(\self)$ rounded to the nearestf64
value is returned.
The midpoint of a nonempty interval $π = [a, b]$ is defined as follows:
$$ \operatorname{mid}(π) = \frac{1}{2}(a + b). $$
Examples
use inari::*; assert_eq!(const_interval!(-2.0, 3.0).mid(), 0.5); assert_eq!(const_interval!(f64::NEG_INFINITY, 3.0).mid(), f64::MIN); assert_eq!(const_interval!(-2.0, f64::INFINITY).mid(), f64::MAX); assert!(Interval::EMPTY.mid().is_nan()); assert_eq!(Interval::ENTIRE.mid(), 0.0);
See also: Interval::rad
.
pub fn mig(self) -> f64
[src]
pub fn mig(self) -> f64
[src]Returns the mignitude of self
if self
is nonempty; otherwise, NaN.
The mignitude of a nonempty interval $π = [a, b]$ is defined as follows:
$$ \operatorname{mig}(π) = \inf\{|x| β£ x β π\} = \begin{cases} \min(|a|, |b|) & \text{if } \sgn(a) = \sgn(b), \\ 0 & \text{otherwise}. \end{cases} $$
Examples
use inari::*; assert_eq!(const_interval!(-2.0, 3.0).mig(), 0.0); assert_eq!(const_interval!(2.0, 3.0).mig(), 2.0); assert!(Interval::EMPTY.mig().is_nan()); assert_eq!(Interval::ENTIRE.mig(), 0.0);
See also: Interval::mag
.
pub fn rad(self) -> f64
[src]
pub fn rad(self) -> f64
[src]Returns the radius of self
if self
is nonempty; otherwise, NaN.
The result $r$ is the smallest f64
number that satisfies
$\self β [m - r, m + r]$ where $m$ is the f64
value returned by self.mid()
.
The radius of a nonempty interval $π = [a, b]$ is defined as follows:
$$ \operatorname{rad}(π) = \frac{1}{2}(b - a). $$
Examples
use inari::*; assert_eq!(const_interval!(-2.0, 3.0).rad(), 2.5); assert!(Interval::EMPTY.rad().is_nan()); assert_eq!(Interval::ENTIRE.rad(), f64::INFINITY);
See also: Interval::mid
.
pub fn sup(self) -> f64
[src]
pub fn sup(self) -> f64
[src]Returns the (least) upper bound of self
.
Equivalently, it returns $b$ if $\self = [a, b]$ is nonempty; otherwise, $-β$.
Examples
use inari::*; assert_eq!(const_interval!(-2.0, 3.0).sup(), 3.0); assert_eq!(Interval::EMPTY.sup(), f64::NEG_INFINITY); assert_eq!(Interval::ENTIRE.sup(), f64::INFINITY);
See also: Interval::inf
.
pub fn wid(self) -> f64
[src]
pub fn wid(self) -> f64
[src]Returns the width of self
if self
is nonempty; otherwise, NaN.
The result is rounded toward $+β$.
The width of a nonempty interval $π = [a, b]$ is defined as follows:
$$ \operatorname{wid}(π) = b - a. $$
Examples
use inari::*; assert_eq!(const_interval!(-2.0, 3.0).wid(), 5.0); assert_eq!(const_interval!(-1.0, f64::MAX).wid(), f64::INFINITY); assert!(Interval::EMPTY.wid().is_nan()); assert_eq!(Interval::ENTIRE.wid(), f64::INFINITY);
impl Interval
[src]
impl Interval
[src]pub fn convex_hull(self, rhs: Self) -> Self
[src]
pub fn convex_hull(self, rhs: Self) -> Self
[src]Returns $[\min(a, c), \max(b, d)]$ if both $\self = [a, b]$ and $\rhs = [c, d]$ are nonempty. If either interval is empty, the other is returned. If both are empty, $β $ is returned.
This is equivalent to $\self βͺ \rhs$ if the intervals are not disjoint,
Tightness: tightest
pub fn intersection(self, rhs: Self) -> Self
[src]
pub fn intersection(self, rhs: Self) -> Self
[src]Returns $\self β© \rhs$. If the result is nonempty, it is equivalent to $[\max(a, c), \min(b, d)]$, where both $\self = [a, b]$ and $\rhs = [c, d]$ are nonempty.
Tightness: tightest
Trait Implementations
impl AddAssign<Interval> for Interval
[src]
impl AddAssign<Interval> for Interval
[src]fn add_assign(&mut self, rhs: Self)
[src]
fn add_assign(&mut self, rhs: Self)
[src]Performs the +=
operation. Read more
impl DivAssign<Interval> for Interval
[src]
impl DivAssign<Interval> for Interval
[src]fn div_assign(&mut self, rhs: Self)
[src]
fn div_assign(&mut self, rhs: Self)
[src]Performs the /=
operation. Read more
impl MulAssign<Interval> for Interval
[src]
impl MulAssign<Interval> for Interval
[src]fn mul_assign(&mut self, rhs: Self)
[src]
fn mul_assign(&mut self, rhs: Self)
[src]Performs the *=
operation. Read more
impl SubAssign<Interval> for Interval
[src]
impl SubAssign<Interval> for Interval
[src]fn sub_assign(&mut self, rhs: Self)
[src]
fn sub_assign(&mut self, rhs: Self)
[src]Performs the -=
operation. Read more
impl Copy for Interval
[src]
impl Eq for Interval
[src]
Auto Trait Implementations
impl RefUnwindSafe for Interval
impl Send for Interval
impl Sync for Interval
impl Unpin for Interval
impl UnwindSafe for Interval
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> CheckedAs for T
[src]
impl<T> CheckedAs for T
[src]pub fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
[src]
pub fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
[src]Casts the value.
impl<T> FmtForward for T
impl<T> FmtForward for T
fn fmt_binary(self) -> FmtBinary<Self> where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self> where
Self: Binary,
Causes self
to use its Binary
implementation when Debug
-formatted.
fn fmt_display(self) -> FmtDisplay<Self> where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self> where
Self: Display,
Causes self
to use its Display
implementation when
Debug
-formatted. Read more
fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
Self: LowerExp,
Causes self
to use its LowerExp
implementation when
Debug
-formatted. Read more
fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
Self: LowerHex,
Causes self
to use its LowerHex
implementation when
Debug
-formatted. Read more
fn fmt_octal(self) -> FmtOctal<Self> where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self> where
Self: Octal,
Causes self
to use its Octal
implementation when Debug
-formatted.
fn fmt_pointer(self) -> FmtPointer<Self> where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self> where
Self: Pointer,
Causes self
to use its Pointer
implementation when
Debug
-formatted. Read more
fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
Self: UpperExp,
Causes self
to use its UpperExp
implementation when
Debug
-formatted. Read more
fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
Self: UpperHex,
Causes self
to use its UpperHex
implementation when
Debug
-formatted. Read more
impl<T> OverflowingAs for T
[src]
impl<T> OverflowingAs for T
[src]pub fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
[src]
pub fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
[src]Casts the value.
impl<T> Pipe for T where
T: ?Sized,
impl<T> Pipe for T where
T: ?Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
Pipes by value. This is generally the method you want to use. Read more
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R where
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R where
R: 'a,
Borrows self
and passes that borrow into the pipe function. Read more
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R where
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R where
R: 'a,
Mutably borrows self
and passes that borrow into the pipe function. Read more
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R where
Self: Borrow<B>,
R: 'a,
B: 'a + ?Sized,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R where
Self: Borrow<B>,
R: 'a,
B: 'a + ?Sized,
Borrows self
, then passes self.borrow()
into the pipe function. Read more
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
Self: BorrowMut<B>,
R: 'a,
B: 'a + ?Sized,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
Self: BorrowMut<B>,
R: 'a,
B: 'a + ?Sized,
Mutably borrows self
, then passes self.borrow_mut()
into the pipe
function. Read more
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
Self: AsRef<U>,
R: 'a,
U: 'a + ?Sized,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
Self: AsRef<U>,
R: 'a,
U: 'a + ?Sized,
Borrows self
, then passes self.as_ref()
into the pipe function.
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R where
Self: AsMut<U>,
R: 'a,
U: 'a + ?Sized,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R where
Self: AsMut<U>,
R: 'a,
U: 'a + ?Sized,
Mutably borrows self
, then passes self.as_mut()
into the pipe
function. Read more
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
Borrows self
, then passes self.deref()
into the pipe function.
impl<T> PipeAsRef for T
impl<T> PipeAsRef for T
fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: AsRef<T>,
T: 'a,
R: 'a,
fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: AsRef<T>,
T: 'a,
R: 'a,
Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more
fn pipe_as_mut<'a, T, R>(&'a mut self, func: impl FnOnce(&'a mut T) -> R) -> R where
Self: AsMut<T>,
T: 'a,
R: 'a,
fn pipe_as_mut<'a, T, R>(&'a mut self, func: impl FnOnce(&'a mut T) -> R) -> R where
Self: AsMut<T>,
T: 'a,
R: 'a,
Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more
impl<T> PipeBorrow for T
impl<T> PipeBorrow for T
fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Borrow<T>,
T: 'a,
R: 'a,
fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Borrow<T>,
T: 'a,
R: 'a,
Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more
fn pipe_borrow_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: BorrowMut<T>,
T: 'a,
R: 'a,
fn pipe_borrow_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: BorrowMut<T>,
T: 'a,
R: 'a,
Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more
impl<T> PipeDeref for T
impl<T> PipeDeref for T
fn pipe_deref<'a, R>(&'a self, func: impl FnOnce(&'a Self::Target) -> R) -> R where
Self: Deref,
R: 'a,
fn pipe_deref<'a, R>(&'a self, func: impl FnOnce(&'a Self::Target) -> R) -> R where
Self: Deref,
R: 'a,
Pipes a dereference into a function that cannot normally be called in suffix position. Read more
fn pipe_deref_mut<'a, R>(
&'a mut self,
func: impl FnOnce(&'a mut Self::Target) -> R
) -> R where
Self: DerefMut,
R: 'a,
fn pipe_deref_mut<'a, R>(
&'a mut self,
func: impl FnOnce(&'a mut Self::Target) -> R
) -> R where
Self: DerefMut,
R: 'a,
Pipes a mutable dereference into a function that cannot normally be called in suffix position. Read more
impl<T> PipeRef for T
impl<T> PipeRef for T
impl<T> SaturatingAs for T
[src]
impl<T> SaturatingAs for T
[src]pub fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
[src]
pub fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
[src]Casts the value.
impl<T> Tap for T
impl<T> Tap for T
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
Immutable access to the Borrow<B>
of a value. Read more
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
Mutable access to the BorrowMut<B>
of a value. Read more
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
Immutable access to the AsRef<R>
view of a value. Read more
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
Mutable access to the AsMut<R>
view of a value. Read more
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
Immutable access to the Deref::Target
of a value. Read more
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Mutable access to the Deref::Target
of a value. Read more
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls .tap()
only in debug builds, and is erased in release builds.
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls .tap_mut()
only in debug builds, and is erased in release
builds. Read more
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
Calls .tap_borrow()
only in debug builds, and is erased in release
builds. Read more
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
Calls .tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read more
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
Calls .tap_ref()
only in debug builds, and is erased in release
builds. Read more
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
Calls .tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more
impl<T> Tap for T
impl<T> Tap for T
fn tap<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
fn tap<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
Provides immutable access for inspection. Read more
fn tap_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
fn tap_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
Calls tap
in debug builds, and does nothing in release builds.
fn tap_mut<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
fn tap_mut<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
Provides mutable access for modification. Read more
fn tap_mut_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
fn tap_mut_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
Calls tap_mut
in debug builds, and does nothing in release builds.
impl<T, U> TapAsRef<U> for T where
U: ?Sized,
impl<T, U> TapAsRef<U> for T where
U: ?Sized,
fn tap_ref<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
Provides immutable access to the reference for inspection.
fn tap_ref_dbg<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref_dbg<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
Calls tap_ref
in debug builds, and does nothing in release builds.
fn tap_ref_mut<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
Provides mutable access to the reference for modification.
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
Calls tap_ref_mut
in debug builds, and does nothing in release builds.
impl<T, U> TapBorrow<U> for T where
U: ?Sized,
impl<T, U> TapBorrow<U> for T where
U: ?Sized,
fn tap_borrow<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
Provides immutable access to the borrow for inspection. Read more
fn tap_borrow_dbg<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow_dbg<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
Calls tap_borrow
in debug builds, and does nothing in release builds.
fn tap_borrow_mut<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
Provides mutable access to the borrow for modification.
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
Calls tap_borrow_mut
in debug builds, and does nothing in release
builds. Read more
impl<T> TapDeref for T
impl<T> TapDeref for T
fn tap_deref<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
Immutably dereferences self
for inspection.
fn tap_deref_dbg<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref_dbg<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
Calls tap_deref
in debug builds, and does nothing in release builds.
fn tap_deref_mut<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
Mutably dereferences self
for modification.
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
Calls tap_deref_mut
in debug builds, and does nothing in release
builds. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]π¬ This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> UnwrappedAs for T
[src]
impl<T> UnwrappedAs for T
[src]pub fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
[src]
pub fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
[src]Casts the value.
impl<T> WrappingAs for T
[src]
impl<T> WrappingAs for T
[src]pub fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
[src]
pub fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
[src]Casts the value.