CheckedSub

Trait CheckedSub 

Source
pub trait CheckedSub<Rhs = Self>
where Self: Sized,
{ type Output; type Error; // Required method fn checked_sub(self, rhs: Rhs) -> Result<Self::Output, Self::Error>; }

Required Associated Types§

Required Methods§

Source

fn checked_sub(self, rhs: Rhs) -> Result<Self::Output, Self::Error>

Checked arithmetic subtraction from self

§Errors

When the result of the subtraction can not be represented (e.g. due to an overflow).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl CheckedSub for i64

Source§

type Output = i64

Source§

type Error = SubError<i64, i64>

Source§

fn checked_sub(self, rhs: Self) -> Result<Self::Output, Self::Error>

Source§

impl CheckedSub for u32

Source§

type Output = u32

Source§

type Error = SubError<u32, u32>

Source§

fn checked_sub(self, rhs: Self) -> Result<Self::Output, Self::Error>

Implementors§