Trait otter_api_tests::imports::failure::_core::ops::Sub 1.0.0[−][src]
Expand description
The subtraction operator -
.
Note that Rhs
is Self
by default, but this is not mandatory. For
example, std::time::SystemTime
implements Sub<Duration>
, which permits
operations of the form SystemTime = SystemTime - Duration
.
Examples
Sub
tractable points
use std::ops::Sub; #[derive(Debug, Copy, Clone, PartialEq)] struct Point { x: i32, y: i32, } impl Sub for Point { type Output = Self; fn sub(self, other: Self) -> Self::Output { Self { x: self.x - other.x, y: self.y - other.y, } } } assert_eq!(Point { x: 3, y: 3 } - Point { x: 2, y: 3 }, Point { x: 1, y: 0 });
Implementing Sub
with generics
Here is an example of the same Point
struct implementing the Sub
trait
using generics.
use std::ops::Sub; #[derive(Debug, PartialEq)] struct Point<T> { x: T, y: T, } // Notice that the implementation uses the associated type `Output`. impl<T: Sub<Output = T>> Sub for Point<T> { type Output = Self; fn sub(self, other: Self) -> Self::Output { Point { x: self.x - other.x, y: self.y - other.y, } } } assert_eq!(Point { x: 2, y: 3 } - Point { x: 1, y: 0 }, Point { x: 1, y: 3 });
Associated Types
Required methods
Implementations on Foreign Types
type Output = LibInBundleI
type Output = SteadyTime
impl Sub<Op> for Op
impl Sub<Op> for Op
impl Sub<EventMask> for EventMask
impl Sub<EventMask> for EventMask
impl Sub<WatchMask> for WatchMask
impl Sub<WatchMask> for WatchMask
impl Sub<Transformations> for Transformations
impl Sub<Transformations> for Transformations
impl Sub<FileType> for FileType
impl Sub<FileType> for FileType
impl<'_, '_, T, S1, S2> Sub<&'_ IndexSet<T, S2>> for &'_ IndexSet<T, S1> where
T: Eq + Hash + Clone,
S1: BuildHasher + Default,
S2: BuildHasher,
[src]
impl<'_, '_, T, S1, S2> Sub<&'_ IndexSet<T, S2>> for &'_ IndexSet<T, S1> where
T: Eq + Hash + Clone,
S1: BuildHasher + Default,
S2: BuildHasher,
[src]pub fn sub(self, rhs: &HashSet<T, S>) -> HashSet<T, S>
pub fn sub(self, rhs: &HashSet<T, S>) -> HashSet<T, S>
Returns the difference of self
and rhs
as a new HashSet<T, S>
.
Examples
use hashbrown::HashSet; let a: HashSet<_> = vec![1, 2, 3].into_iter().collect(); let b: HashSet<_> = vec![3, 4, 5].into_iter().collect(); let set = &a - &b; let mut i = 0; let expected = [1, 2]; for x in &set { assert!(expected.contains(x)); i += 1; } assert_eq!(i, expected.len());
type Output = HashSet<T, S>
Returns the set difference of the two sets of flags.
type Output = ExtensionContext
Returns the set difference of the two sets of flags.
type Output = X509CheckFlags
Returns the set difference of the two sets of flags.
type Output = X509VerifyFlags
Returns the set difference of the two sets of flags.
type Output = SslVerifyMode
Returns the set difference of the two sets of flags.
type Output = SslSessionCacheMode
Returns the set difference of the two sets of flags.
type Output = Pkcs7Flags
Returns the set difference of the two sets of flags.
type Output = CMSOptions
Returns the set difference of the two sets of flags.
type Output = SslOptions
Returns the set difference of the two sets of flags.
type Output = ShutdownState
Implementors
type Output = LibInBundleI
type Output = LibInBundleI
type Output = SystemTime
impl Sub<AccessFlags> for AccessFlags
impl Sub<AccessFlags> for AccessFlags
pub fn sub(self, other: AccessFlags) -> AccessFlags
pub fn sub(self, other: AccessFlags) -> AccessFlags
Returns the set difference of the two sets of flags.
type Output = AccessFlags
A subtraction of Duration
from NaiveDate
discards the fractional days,
rounding to the closest integral number of days towards Duration::zero()
.
It is the same as the addition with a negated Duration
.
Panics on underflow or overflow.
Use NaiveDate::checked_sub_signed
to detect that.
Example
use chrono::{Duration, NaiveDate}; let from_ymd = NaiveDate::from_ymd; assert_eq!(from_ymd(2014, 1, 1) - Duration::zero(), from_ymd(2014, 1, 1)); assert_eq!(from_ymd(2014, 1, 1) - Duration::seconds(86399), from_ymd(2014, 1, 1)); assert_eq!(from_ymd(2014, 1, 1) - Duration::seconds(-86399), from_ymd(2014, 1, 1)); assert_eq!(from_ymd(2014, 1, 1) - Duration::days(1), from_ymd(2013, 12, 31)); assert_eq!(from_ymd(2014, 1, 1) - Duration::days(-1), from_ymd(2014, 1, 2)); assert_eq!(from_ymd(2014, 1, 1) - Duration::days(364), from_ymd(2013, 1, 2)); assert_eq!(from_ymd(2014, 1, 1) - Duration::days(365*4 + 1), from_ymd(2010, 1, 1)); assert_eq!(from_ymd(2014, 1, 1) - Duration::days(365*400 + 97), from_ymd(1614, 1, 1));
A subtraction of Duration
from NaiveDateTime
yields another NaiveDateTime
.
It is the same as the addition with a negated Duration
.
As a part of Chrono’s leap second handling,
the addition assumes that there is no leap second ever,
except when the NaiveDateTime
itself represents a leap second
in which case the assumption becomes that there is exactly a single leap second ever.
Panics on underflow or overflow.
Use NaiveDateTime::checked_sub_signed
to detect that.
Example
use chrono::{Duration, NaiveDate}; let from_ymd = NaiveDate::from_ymd; let d = from_ymd(2016, 7, 8); let hms = |h, m, s| d.and_hms(h, m, s); assert_eq!(hms(3, 5, 7) - Duration::zero(), hms(3, 5, 7)); assert_eq!(hms(3, 5, 7) - Duration::seconds(1), hms(3, 5, 6)); assert_eq!(hms(3, 5, 7) - Duration::seconds(-1), hms(3, 5, 8)); assert_eq!(hms(3, 5, 7) - Duration::seconds(3600 + 60), hms(2, 4, 7)); assert_eq!(hms(3, 5, 7) - Duration::seconds(86_400), from_ymd(2016, 7, 7).and_hms(3, 5, 7)); assert_eq!(hms(3, 5, 7) - Duration::days(365), from_ymd(2015, 7, 9).and_hms(3, 5, 7)); let hmsm = |h, m, s, milli| d.and_hms_milli(h, m, s, milli); assert_eq!(hmsm(3, 5, 7, 450) - Duration::milliseconds(670), hmsm(3, 5, 6, 780));
Leap seconds are handled, but the subtraction assumes that it is the only leap second happened.
let leap = hmsm(3, 5, 59, 1_300); assert_eq!(leap - Duration::zero(), hmsm(3, 5, 59, 1_300)); assert_eq!(leap - Duration::milliseconds(200), hmsm(3, 5, 59, 1_100)); assert_eq!(leap - Duration::milliseconds(500), hmsm(3, 5, 59, 800)); assert_eq!(leap - Duration::seconds(60), hmsm(3, 5, 0, 300)); assert_eq!(leap - Duration::days(1), from_ymd(2016, 7, 7).and_hms_milli(3, 6, 0, 300));
type Output = NaiveDateTime
A subtraction of Duration
from NaiveTime
wraps around and never overflows or underflows.
In particular the addition ignores integral number of days.
It is the same as the addition with a negated Duration
.
As a part of Chrono’s leap second handling,
the addition assumes that there is no leap second ever,
except when the NaiveTime
itself represents a leap second
in which case the assumption becomes that there is exactly a single leap second ever.
Example
use chrono::{Duration, NaiveTime}; let from_hmsm = NaiveTime::from_hms_milli; assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::zero(), from_hmsm(3, 5, 7, 0)); assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::seconds(1), from_hmsm(3, 5, 6, 0)); assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::seconds(60 + 5), from_hmsm(3, 4, 2, 0)); assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::seconds(2*60*60 + 6*60), from_hmsm(0, 59, 7, 0)); assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::milliseconds(80), from_hmsm(3, 5, 6, 920)); assert_eq!(from_hmsm(3, 5, 7, 950) - Duration::milliseconds(280), from_hmsm(3, 5, 7, 670));
The subtraction wraps around.
assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::seconds(8*60*60), from_hmsm(19, 5, 7, 0)); assert_eq!(from_hmsm(3, 5, 7, 0) - Duration::days(800), from_hmsm(3, 5, 7, 0));
Leap seconds are handled, but the subtraction assumes that it is the only leap second happened.
let leap = from_hmsm(3, 5, 59, 1_300); assert_eq!(leap - Duration::zero(), from_hmsm(3, 5, 59, 1_300)); assert_eq!(leap - Duration::milliseconds(200), from_hmsm(3, 5, 59, 1_100)); assert_eq!(leap - Duration::milliseconds(500), from_hmsm(3, 5, 59, 800)); assert_eq!(leap - Duration::seconds(60), from_hmsm(3, 5, 0, 300)); assert_eq!(leap - Duration::days(1), from_hmsm(3, 6, 0, 300));
type Output = NaiveDateTime
Subtracts another NaiveDate
from the current date.
Returns a Duration
of integral numbers.
This does not overflow or underflow at all,
as all possible output fits in the range of Duration
.
The implementation is a wrapper around
NaiveDate::signed_duration_since
.
Example
use chrono::{Duration, NaiveDate}; let from_ymd = NaiveDate::from_ymd; assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2014, 1, 1), Duration::zero()); assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2013, 12, 31), Duration::days(1)); assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2014, 1, 2), Duration::days(-1)); assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2013, 9, 23), Duration::days(100)); assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2013, 1, 1), Duration::days(365)); assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2010, 1, 1), Duration::days(365*4 + 1)); assert_eq!(from_ymd(2014, 1, 1) - from_ymd(1614, 1, 1), Duration::days(365*400 + 97));
Subtracts another NaiveDateTime
from the current date and time.
This does not overflow or underflow at all.
As a part of Chrono’s leap second handling,
the subtraction assumes that there is no leap second ever,
except when any of the NaiveDateTime
s themselves represents a leap second
in which case the assumption becomes that
there are exactly one (or two) leap second(s) ever.
The implementation is a wrapper around
NaiveDateTime::signed_duration_since
.
Example
use chrono::{Duration, NaiveDate}; let from_ymd = NaiveDate::from_ymd; let d = from_ymd(2016, 7, 8); assert_eq!(d.and_hms(3, 5, 7) - d.and_hms(2, 4, 6), Duration::seconds(3600 + 60 + 1)); // July 8 is 190th day in the year 2016 let d0 = from_ymd(2016, 1, 1); assert_eq!(d.and_hms_milli(0, 7, 6, 500) - d0.and_hms(0, 0, 0), Duration::seconds(189 * 86_400 + 7 * 60 + 6) + Duration::milliseconds(500));
Leap seconds are handled, but the subtraction assumes that there were no other leap seconds happened.
let leap = from_ymd(2015, 6, 30).and_hms_milli(23, 59, 59, 1_500); assert_eq!(leap - from_ymd(2015, 6, 30).and_hms(23, 0, 0), Duration::seconds(3600) + Duration::milliseconds(500)); assert_eq!(from_ymd(2015, 7, 1).and_hms(1, 0, 0) - leap, Duration::seconds(3600) - Duration::milliseconds(500));
Subtracts another NaiveTime
from the current time.
Returns a Duration
within +/- 1 day.
This does not overflow or underflow at all.
As a part of Chrono’s leap second handling,
the subtraction assumes that there is no leap second ever,
except when any of the NaiveTime
s themselves represents a leap second
in which case the assumption becomes that
there are exactly one (or two) leap second(s) ever.
The implementation is a wrapper around
NaiveTime::signed_duration_since
.
Example
use chrono::{Duration, NaiveTime}; let from_hmsm = NaiveTime::from_hms_milli; assert_eq!(from_hmsm(3, 5, 7, 900) - from_hmsm(3, 5, 7, 900), Duration::zero()); assert_eq!(from_hmsm(3, 5, 7, 900) - from_hmsm(3, 5, 7, 875), Duration::milliseconds(25)); assert_eq!(from_hmsm(3, 5, 7, 900) - from_hmsm(3, 5, 6, 925), Duration::milliseconds(975)); assert_eq!(from_hmsm(3, 5, 7, 900) - from_hmsm(3, 5, 0, 900), Duration::seconds(7)); assert_eq!(from_hmsm(3, 5, 7, 900) - from_hmsm(3, 0, 7, 900), Duration::seconds(5 * 60)); assert_eq!(from_hmsm(3, 5, 7, 900) - from_hmsm(0, 5, 7, 900), Duration::seconds(3 * 3600)); assert_eq!(from_hmsm(3, 5, 7, 900) - from_hmsm(4, 5, 7, 900), Duration::seconds(-3600)); assert_eq!(from_hmsm(3, 5, 7, 900) - from_hmsm(2, 4, 6, 800), Duration::seconds(3600 + 60 + 1) + Duration::milliseconds(100));
Leap seconds are handled, but the subtraction assumes that there were no other leap seconds happened.
assert_eq!(from_hmsm(3, 0, 59, 1_000) - from_hmsm(3, 0, 59, 0), Duration::seconds(1)); assert_eq!(from_hmsm(3, 0, 59, 1_500) - from_hmsm(3, 0, 59, 0), Duration::milliseconds(1500)); assert_eq!(from_hmsm(3, 0, 59, 1_000) - from_hmsm(3, 0, 0, 0), Duration::seconds(60)); assert_eq!(from_hmsm(3, 0, 0, 0) - from_hmsm(2, 59, 59, 1_000), Duration::seconds(1)); assert_eq!(from_hmsm(3, 0, 59, 1_000) - from_hmsm(2, 59, 59, 1_000), Duration::seconds(61));
UTerm - B0 = Term
UInt<UTerm, B1> - B1 = UTerm
UTerm - UTerm = UTerm
impl Sub<FallocateFlags> for FallocateFlags
impl Sub<FallocateFlags> for FallocateFlags
pub fn sub(self, other: FallocateFlags) -> FallocateFlags
pub fn sub(self, other: FallocateFlags) -> FallocateFlags
Returns the set difference of the two sets of flags.
type Output = FallocateFlags
impl Sub<SpliceFFlags> for SpliceFFlags
impl Sub<SpliceFFlags> for SpliceFFlags
pub fn sub(self, other: SpliceFFlags) -> SpliceFFlags
pub fn sub(self, other: SpliceFFlags) -> SpliceFFlags
Returns the set difference of the two sets of flags.
type Output = SpliceFFlags
impl Sub<DeleteModuleFlags> for DeleteModuleFlags
impl Sub<DeleteModuleFlags> for DeleteModuleFlags
pub fn sub(self, other: DeleteModuleFlags) -> DeleteModuleFlags
pub fn sub(self, other: DeleteModuleFlags) -> DeleteModuleFlags
Returns the set difference of the two sets of flags.
type Output = DeleteModuleFlags
impl Sub<ModuleInitFlags> for ModuleInitFlags
impl Sub<ModuleInitFlags> for ModuleInitFlags
pub fn sub(self, other: ModuleInitFlags) -> ModuleInitFlags
pub fn sub(self, other: ModuleInitFlags) -> ModuleInitFlags
Returns the set difference of the two sets of flags.
type Output = ModuleInitFlags
impl Sub<InterfaceFlags> for InterfaceFlags
impl Sub<InterfaceFlags> for InterfaceFlags
pub fn sub(self, other: InterfaceFlags) -> InterfaceFlags
pub fn sub(self, other: InterfaceFlags) -> InterfaceFlags
Returns the set difference of the two sets of flags.
type Output = InterfaceFlags
impl Sub<CloneFlags> for CloneFlags
impl Sub<CloneFlags> for CloneFlags
pub fn sub(self, other: CloneFlags) -> CloneFlags
pub fn sub(self, other: CloneFlags) -> CloneFlags
Returns the set difference of the two sets of flags.
type Output = CloneFlags
impl Sub<EpollCreateFlags> for EpollCreateFlags
impl Sub<EpollCreateFlags> for EpollCreateFlags
pub fn sub(self, other: EpollCreateFlags) -> EpollCreateFlags
pub fn sub(self, other: EpollCreateFlags) -> EpollCreateFlags
Returns the set difference of the two sets of flags.
type Output = EpollCreateFlags
impl Sub<EpollFlags> for EpollFlags
impl Sub<EpollFlags> for EpollFlags
pub fn sub(self, other: EpollFlags) -> EpollFlags
pub fn sub(self, other: EpollFlags) -> EpollFlags
Returns the set difference of the two sets of flags.
type Output = EpollFlags
impl Sub<AddWatchFlags> for AddWatchFlags
impl Sub<AddWatchFlags> for AddWatchFlags
pub fn sub(self, other: AddWatchFlags) -> AddWatchFlags
pub fn sub(self, other: AddWatchFlags) -> AddWatchFlags
Returns the set difference of the two sets of flags.
type Output = AddWatchFlags
impl Sub<MemFdCreateFlag> for MemFdCreateFlag
impl Sub<MemFdCreateFlag> for MemFdCreateFlag
pub fn sub(self, other: MemFdCreateFlag) -> MemFdCreateFlag
pub fn sub(self, other: MemFdCreateFlag) -> MemFdCreateFlag
Returns the set difference of the two sets of flags.
type Output = MemFdCreateFlag
impl Sub<MRemapFlags> for MRemapFlags
impl Sub<MRemapFlags> for MRemapFlags
pub fn sub(self, other: MRemapFlags) -> MRemapFlags
pub fn sub(self, other: MRemapFlags) -> MRemapFlags
Returns the set difference of the two sets of flags.
type Output = MRemapFlags
impl Sub<MlockAllFlags> for MlockAllFlags
impl Sub<MlockAllFlags> for MlockAllFlags
pub fn sub(self, other: MlockAllFlags) -> MlockAllFlags
pub fn sub(self, other: MlockAllFlags) -> MlockAllFlags
Returns the set difference of the two sets of flags.
type Output = MlockAllFlags
impl Sub<QuotaValidFlags> for QuotaValidFlags
impl Sub<QuotaValidFlags> for QuotaValidFlags
pub fn sub(self, other: QuotaValidFlags) -> QuotaValidFlags
pub fn sub(self, other: QuotaValidFlags) -> QuotaValidFlags
Returns the set difference of the two sets of flags.
type Output = QuotaValidFlags
impl Sub<ControlFlags> for ControlFlags
impl Sub<ControlFlags> for ControlFlags
pub fn sub(self, other: ControlFlags) -> ControlFlags
pub fn sub(self, other: ControlFlags) -> ControlFlags
Returns the set difference of the two sets of flags.
type Output = ControlFlags
impl Sub<InputFlags> for InputFlags
impl Sub<InputFlags> for InputFlags
pub fn sub(self, other: InputFlags) -> InputFlags
pub fn sub(self, other: InputFlags) -> InputFlags
Returns the set difference of the two sets of flags.
type Output = InputFlags
impl Sub<LocalFlags> for LocalFlags
impl Sub<LocalFlags> for LocalFlags
pub fn sub(self, other: LocalFlags) -> LocalFlags
pub fn sub(self, other: LocalFlags) -> LocalFlags
Returns the set difference of the two sets of flags.
type Output = LocalFlags
impl Sub<OutputFlags> for OutputFlags
impl Sub<OutputFlags> for OutputFlags
pub fn sub(self, other: OutputFlags) -> OutputFlags
pub fn sub(self, other: OutputFlags) -> OutputFlags
Returns the set difference of the two sets of flags.
type Output = OutputFlags
impl Sub<TimerFlags> for TimerFlags
impl Sub<TimerFlags> for TimerFlags
pub fn sub(self, other: TimerFlags) -> TimerFlags
pub fn sub(self, other: TimerFlags) -> TimerFlags
Returns the set difference of the two sets of flags.
type Output = TimerFlags
impl Sub<TimerSetTimeFlags> for TimerSetTimeFlags
impl Sub<TimerSetTimeFlags> for TimerSetTimeFlags
pub fn sub(self, other: TimerSetTimeFlags) -> TimerSetTimeFlags
pub fn sub(self, other: TimerSetTimeFlags) -> TimerSetTimeFlags
Returns the set difference of the two sets of flags.
type Output = TimerSetTimeFlags
impl Sub<WaitPidFlag> for WaitPidFlag
impl Sub<WaitPidFlag> for WaitPidFlag
pub fn sub(self, other: WaitPidFlag) -> WaitPidFlag
pub fn sub(self, other: WaitPidFlag) -> WaitPidFlag
Returns the set difference of the two sets of flags.
type Output = WaitPidFlag
Returns the difference of self
and rhs
as a new BTreeSet<T>
.
Examples
use std::collections::BTreeSet; let a: BTreeSet<_> = vec![1, 2, 3].into_iter().collect(); let b: BTreeSet<_> = vec![3, 4, 5].into_iter().collect(); let result = &a - &b; let result_vec: Vec<_> = result.into_iter().collect(); assert_eq!(result_vec, [1, 2]);
Returns the difference of self
and rhs
as a new HashSet<T, S>
.
Examples
use std::collections::HashSet; let a: HashSet<_> = vec![1, 2, 3].into_iter().collect(); let b: HashSet<_> = vec![3, 4, 5].into_iter().collect(); let set = &a - &b; let mut i = 0; let expected = [1, 2]; for x in &set { assert!(expected.contains(x)); i += 1; } assert_eq!(i, expected.len());
impl<'a, T> Sub<&'a OrderedFloat<T>> for &'a OrderedFloat<T> where
&'a T: Sub<&'a T>,
impl<'a, T> Sub<&'a OrderedFloat<T>> for &'a OrderedFloat<T> where
&'a T: Sub<&'a T>,
pub fn sub(
self,
other: &'a OrderedFloat<T>
) -> <&'a OrderedFloat<T> as Sub<&'a OrderedFloat<T>>>::Output
impl<'a, T> Sub<&'a OrderedFloat<T>> for OrderedFloat<T> where
T: Sub<&'a T>,
impl<'a, T> Sub<&'a OrderedFloat<T>> for OrderedFloat<T> where
T: Sub<&'a T>,
type Output = OrderedFloat<<T as Sub<&'a T>>::Output>
pub fn sub(
self,
other: &'a OrderedFloat<T>
) -> <OrderedFloat<T> as Sub<&'a OrderedFloat<T>>>::Output
impl<'a, T> Sub<&'a T> for OrderedFloat<T> where
T: Sub<&'a T>,
impl<'a, T> Sub<&'a T> for OrderedFloat<T> where
T: Sub<&'a T>,
impl<'a, T> Sub<OrderedFloat<T>> for &'a OrderedFloat<T> where
&'a T: Sub<T>,
impl<'a, T> Sub<OrderedFloat<T>> for &'a OrderedFloat<T> where
&'a T: Sub<T>,
type Output = OrderedFloat<<&'a T as Sub<T>>::Output>
pub fn sub(
self,
other: OrderedFloat<T>
) -> <&'a OrderedFloat<T> as Sub<OrderedFloat<T>>>::Output
impl<'a, T> Sub<T> for &'a OrderedFloat<T> where
&'a T: Sub<T>,
impl<'a, T> Sub<T> for &'a OrderedFloat<T> where
&'a T: Sub<T>,
type Output = OrderedFloat<<&'a T as Sub<T>>::Output>
pub fn sub(self, other: T) -> <&'a OrderedFloat<T> as Sub<T>>::Output
impl<T> Sub<OrderedFloat<T>> for OrderedFloat<T> where
T: Sub<T>,
impl<T> Sub<OrderedFloat<T>> for OrderedFloat<T> where
T: Sub<T>,
type Output = OrderedFloat<<T as Sub<T>>::Output>
pub fn sub(
self,
other: OrderedFloat<T>
) -> <OrderedFloat<T> as Sub<OrderedFloat<T>>>::Output
impl<T> Sub<PosC<T>> for PosC<T> where
T: CheckedArith,
impl<T> Sub<PosC<T>> for PosC<T> where
T: CheckedArith,
type Output = Result<PosC<T>, CoordinateOverflow>
pub fn sub(self, rhs: PosC<T>) -> Result<PosC<T>, CoordinateOverflow>
impl<T> Sub<T> for OrderedFloat<T> where
T: Sub<T>,
impl<T> Sub<T> for OrderedFloat<T> where
T: Sub<T>,
type Output = OrderedFloat<<T as Sub<T>>::Output>
pub fn sub(self, other: T) -> <OrderedFloat<T> as Sub<T>>::Output
Subtracts a float directly.
Panics if the provided value is NaN or the computation results in NaN
UInt<U, B0> - B1 = UInt<U - B1, B1>
Z0 - N = P
Z0 - P = N
NInt - Z0 = NInt
PInt - Z0 = PInt
UInt - B0 = UInt
UInt<U, B1> - B1 = UInt<U, B0>
Subtracting unsigned integers. We just do our PrivateSub
and then Trim
the output.
N(Ul) - N(Ur)
: We resolve this with our PrivateAdd
P(Ul) - N(Ur) = P(Ul + Ur)
N(Ul) - P(Ur) = N(Ul + Ur)
P(Ul) - P(Ur)
: We resolve this with our PrivateAdd