hickory_proto::serialize::binary

Trait RestrictedMath

Source
pub trait RestrictedMath {
    type Arg: 'static + Sized + Copy;
    type Value: 'static + Sized + Copy;

    // Required methods
    fn checked_add(
        &self,
        arg: Self::Arg,
    ) -> Result<Restrict<Self::Value>, Self::Arg>;
    fn checked_sub(
        &self,
        arg: Self::Arg,
    ) -> Result<Restrict<Self::Value>, Self::Arg>;
    fn checked_mul(
        &self,
        arg: Self::Arg,
    ) -> Result<Restrict<Self::Value>, Self::Arg>;
}
Expand description

Common checked math operations for the Restrict type

Required Associated Types§

Source

type Arg: 'static + Sized + Copy

Argument for the math operations

Source

type Value: 'static + Sized + Copy

Return value, generally the same as Arg

Required Methods§

Source

fn checked_add( &self, arg: Self::Arg, ) -> Result<Restrict<Self::Value>, Self::Arg>

Checked addition, see usize::checked_add

Source

fn checked_sub( &self, arg: Self::Arg, ) -> Result<Restrict<Self::Value>, Self::Arg>

Checked subtraction, see usize::checked_sub

Source

fn checked_mul( &self, arg: Self::Arg, ) -> Result<Restrict<Self::Value>, Self::Arg>

Checked multiplication, see usize::checked_mul

Implementations on Foreign Types§

Source§

impl<R, A> RestrictedMath for Result<R, A>
where R: RestrictedMath, A: 'static + Sized + Copy,

Source§

type Arg = <R as RestrictedMath>::Arg

Source§

type Value = <R as RestrictedMath>::Value

Source§

fn checked_add( &self, arg: Self::Arg, ) -> Result<Restrict<Self::Value>, Self::Arg>

Source§

fn checked_sub( &self, arg: Self::Arg, ) -> Result<Restrict<Self::Value>, Self::Arg>

Source§

fn checked_mul( &self, arg: Self::Arg, ) -> Result<Restrict<Self::Value>, Self::Arg>

Implementors§