Skip to main content

SumExpression

Struct SumExpression 

Source
pub struct SumExpression<L, R> { /* private fields */ }
Expand description

A deferred sum or difference of two FastFixed expressions.

The operands are aligned to the lesser of their precisions before the addition, as in the C++ library.

Trait Implementations§

Source§

impl<L, R, E> Add<E> for SumExpression<L, R>

Source§

type Output = SumExpression<SumExpression<L, R>, E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: E) -> Self::Output

Performs the + operation. Read more
Source§

impl<I, const FRAC: usize, L, R> Add<FastFixed<I, FRAC>> for SumExpression<L, R>
where I: Bounded + NumCast + Copy, SumExpression<L, R>: FastExpression, FastFixed<I, FRAC>: Add<FastFixed<I, FRAC>>,

Source§

type Output = <FastFixed<I, FRAC> as Add>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: FastFixed<I, FRAC>) -> Self::Output

Performs the + operation. Read more
Source§

impl<L: Clone, R: Clone> Clone for SumExpression<L, R>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable)§

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

Performs copy-assignment from source. Read more
Source§

impl<L: Copy, R: Copy> Copy for SumExpression<L, R>

Source§

impl<L, R> FastExpression for SumExpression<L, R>
where L: FastExpression, R: FastExpression<Int = L::Int>,

Source§

const FRAC: usize

The number of fractional bits of the raw value produced by evaluate_raw.
Source§

type Int = <L as FastExpression>::Int

The 64-bit intermediate integer type the expression is evaluated in.
Source§

fn evaluate_raw(self) -> Self::Int

Evaluates the expression to its raw value with Self::FRAC fractional bits.
Source§

fn evaluate<I, const FRAC_OUT: usize>(self) -> FastFixed<I, FRAC_OUT>
where I: Bounded + NumCast + Copy,

Evaluates the expression into the given FastFixed format, rounding half to even exactly once and saturating when the value does not fit.
Source§

impl<I, const FRAC_OUT: usize, L, R> From<SumExpression<L, R>> for FastFixed<I, FRAC_OUT>
where I: Bounded + NumCast + Copy, SumExpression<L, R>: FastExpression,

Source§

fn from(expr: SumExpression<L, R>) -> Self

Converts to this type from the input type.
Source§

impl<I, const FRAC: usize, L, R> PartialEq<FastFixed<I, FRAC>> for SumExpression<L, R>
where I: Bounded + NumCast + PartialEq + Copy, SumExpression<L, R>: FastExpression,

Source§

fn eq(&self, other: &FastFixed<I, FRAC>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable)§

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

Inequality operator !=. Read more
Source§

impl<I, const FRAC: usize, L, R> PartialOrd<FastFixed<I, FRAC>> for SumExpression<L, R>
where I: Bounded + NumCast + PartialOrd + Copy, SumExpression<L, R>: FastExpression,

Source§

fn partial_cmp(&self, other: &FastFixed<I, FRAC>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable)§

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

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

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 (const: unstable)§

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

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

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<L, R, E> Sub<E> for SumExpression<L, R>

Source§

type Output = SumExpression<SumExpression<L, R>, E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: E) -> Self::Output

Performs the - operation. Read more
Source§

impl<I, const FRAC: usize, L, R> Sub<FastFixed<I, FRAC>> for SumExpression<L, R>
where I: Bounded + NumCast + Copy, SumExpression<L, R>: FastExpression, FastFixed<I, FRAC>: Sub<FastFixed<I, FRAC>>,

Source§

type Output = <FastFixed<I, FRAC> as Sub>::Output

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: FastFixed<I, FRAC>) -> Self::Output

Performs the - operation. Read more

Auto Trait Implementations§

§

impl<L, R> Freeze for SumExpression<L, R>
where L: Freeze, R: Freeze,

§

impl<L, R> RefUnwindSafe for SumExpression<L, R>
where L: RefUnwindSafe, R: RefUnwindSafe,

§

impl<L, R> Send for SumExpression<L, R>
where L: Send, R: Send,

§

impl<L, R> Sync for SumExpression<L, R>
where L: Sync, R: Sync,

§

impl<L, R> Unpin for SumExpression<L, R>
where L: Unpin, R: Unpin,

§

impl<L, R> UnsafeUnpin for SumExpression<L, R>
where L: UnsafeUnpin, R: UnsafeUnpin,

§

impl<L, R> UnwindSafe for SumExpression<L, R>
where L: UnwindSafe, R: UnwindSafe,

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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

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

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.