Struct Wrapper

Source
pub struct Wrapper<M>(pub M);
Expand description

Wrapper that allows to use operators on algebraic types.

Tuple Fields§

§0: M

Trait Implementations§

Source§

impl<M> Add for Wrapper<M>

Source§

type Output = Wrapper<M>

The resulting type after applying the + operator.
Source§

fn add(self, lhs: Self) -> Self

Performs the + operation. Read more
Source§

impl<M> ApproxEq for Wrapper<M>
where M: ApproxEq,

Source§

type Eps = <M as ApproxEq>::Eps

The epsilon type used measure an error.
Source§

fn default_epsilon() -> Self::Eps

The default epsilon value to use in ApproxEq::approx_eq.
Source§

fn approx_eq_eps(&self, b: &Self, epsilon: &Self::Eps) -> bool

Compare a and b for approximate equality using the specified epsilon value.
Source§

fn approx_eq(&self, b: &Self) -> bool

Compare a and b for approximate equality using the default epsilon value returned by ApproxEq::default_epsilon.
Source§

impl<M: Clone> Clone for Wrapper<M>

Source§

fn clone(&self) -> Wrapper<M>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<M: Debug> Debug for Wrapper<M>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<M: Display> Display for Wrapper<M>

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<M> Div for Wrapper<M>

Source§

type Output = Wrapper<M>

The resulting type after applying the / operator.
Source§

fn div(self, lhs: Self) -> Self

Performs the / operation. Read more
Source§

impl<M> Mul for Wrapper<M>

Source§

type Output = Wrapper<M>

The resulting type after applying the * operator.
Source§

fn mul(self, lhs: Self) -> Self

Performs the * operation. Read more
Source§

impl<M> Neg for Wrapper<M>

Source§

type Output = Wrapper<M>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<M: PartialEq> PartialEq for Wrapper<M>

Source§

fn eq(&self, other: &Wrapper<M>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<M: PartialOrd> PartialOrd for Wrapper<M>

Source§

fn partial_cmp(&self, other: &Wrapper<M>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<M> Recip for Wrapper<M>

Source§

type Result = Wrapper<M>

The reciprocal type.
Source§

fn recip(self) -> Self

Returns the reciprocal of self.
Source§

impl<M> Sub for Wrapper<M>

Source§

type Output = Wrapper<M>

The resulting type after applying the - operator.
Source§

fn sub(self, lhs: Self) -> Self

Performs the - operation. Read more
Source§

impl<M: Copy> Copy for Wrapper<M>

Source§

impl<M> StructuralPartialEq for Wrapper<M>

Auto Trait Implementations§

§

impl<M> Freeze for Wrapper<M>
where M: Freeze,

§

impl<M> RefUnwindSafe for Wrapper<M>
where M: RefUnwindSafe,

§

impl<M> Send for Wrapper<M>
where M: Send,

§

impl<M> Sync for Wrapper<M>
where M: Sync,

§

impl<M> Unpin for Wrapper<M>
where M: Unpin,

§

impl<M> UnwindSafe for Wrapper<M>
where M: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Inverse<Additive> for T
where T: Neg<Output = T>,

Source§

fn inv(self) -> T

Returns the inverse of self, relative to the operator O.
Source§

impl<T> Inverse<Multiplicative> for T
where T: Recip<Result = T>,

Source§

fn inv(self) -> T

Returns the inverse of self, relative to the operator O.
Source§

impl<T> MagmaApprox<Additive> for T
where T: Add<Output = T> + PartialEq + ApproxEq + Clone,

Source§

fn approx(self, lhs: T) -> T

Performs an operation.
Source§

fn ap(self, _: O, lhs: Self) -> Self

Performs specific operation.
Source§

impl<T> MagmaApprox<Multiplicative> for T
where T: Mul<Output = T> + PartialEq + ApproxEq + Clone,

Source§

fn approx(self, lhs: T) -> T

Performs an operation.
Source§

fn ap(self, _: O, lhs: Self) -> Self

Performs specific operation.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.