Formula

Enum Formula 

Source
pub enum Formula<QOut, QIn1 = QOut, QIn2 = f32>
where QOut: Quantity + 'static, QIn1: Quantity + 'static + Mul<QIn2, Output = QOut>, QIn2: Quantity + 'static,
{ Subscriber(Box<dyn FormulaSubscriber<QuantityType = QOut>>), Coalesce(Vec<FormulaOperand<QOut>>), Min(Vec<FormulaOperand<QOut>>), Max(Vec<FormulaOperand<QOut>>), Avg(Vec<FormulaOperand<QOut>>), Add(Vec<FormulaOperand<QOut>>), Subtract(Vec<FormulaOperand<QOut>>), Multiply(FormulaOperand<QIn1>, FormulaOperand<QIn2>), Divide(FormulaOperand<QIn1>, FormulaOperand<QIn2>), }
Expand description

A composable Formula.

Variants§

§

Subscriber(Box<dyn FormulaSubscriber<QuantityType = QOut>>)

§

Coalesce(Vec<FormulaOperand<QOut>>)

§

Min(Vec<FormulaOperand<QOut>>)

§

Max(Vec<FormulaOperand<QOut>>)

§

Avg(Vec<FormulaOperand<QOut>>)

§

Add(Vec<FormulaOperand<QOut>>)

§

Subtract(Vec<FormulaOperand<QOut>>)

§

Multiply(FormulaOperand<QIn1>, FormulaOperand<QIn2>)

§

Divide(FormulaOperand<QIn1>, FormulaOperand<QIn2>)

Implementations§

Source§

impl<Q> Formula<Q>
where Q: Quantity + 'static,

Source

pub fn coalesce( self, other: impl Into<FormulaOperand<Q>>, ) -> Result<Formula<Q>, Error>

Source

pub fn min( self, other: impl Into<FormulaOperand<Q>>, ) -> Result<Formula<Q>, Error>

Source

pub fn max( self, other: impl Into<FormulaOperand<Q>>, ) -> Result<Formula<Q>, Error>

Source

pub fn avg(self, others: Vec<Formula<Q>>) -> Result<Formula<Q>, Error>

Source

pub async fn subscribe(&self) -> Result<Receiver<Sample<Q>>, Error>

Trait Implementations§

Source§

impl<Q, F> Add<F> for Formula<Q>
where F: Into<FormulaOperand<Q>>, Q: Quantity + 'static,

Source§

type Output = Formula<Q>

The resulting type after applying the + operator.
Source§

fn add(self, other: F) -> Self::Output

Performs the + operation. Read more
Source§

impl<QOut, QIn1, QIn2> Display for Formula<QOut, QIn1, QIn2>
where QOut: Quantity, QIn1: Quantity + Mul<QIn2, Output = QOut>, QIn2: Quantity,

Source§

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

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

impl<Q> Div<f32> for Formula<Q, Q, f32>
where Q: Quantity + 'static,

Source§

type Output = Formula<Q>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f32) -> Self::Output

Performs the / operation. Read more
Source§

impl<QOut, QIn1, QIn2> FormulaSubscriber for Formula<QOut, QIn1, QIn2>
where QOut: Quantity + 'static, QIn1: Quantity + 'static + Mul<QIn2, Output = QOut> + Div<QIn2, Output = QOut>, QIn2: Quantity + 'static,

Source§

type QuantityType = QOut

Source§

fn subscribe<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Receiver<Sample<QOut>>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl<Q> Mul<f32> for Formula<Q, Q, f32>
where Q: Quantity + 'static,

Source§

type Output = Formula<Q>

The resulting type after applying the * operator.
Source§

fn mul(self, other: f32) -> Self::Output

Performs the * operation. Read more
Source§

impl<Q, F> Sub<F> for Formula<Q>
where F: Into<FormulaOperand<Q>>, Q: Quantity + 'static,

Source§

type Output = Formula<Q>

The resulting type after applying the - operator.
Source§

fn sub(self, other: F) -> Self::Output

Performs the - operation. Read more

Auto Trait Implementations§

§

impl<QOut, QIn1, QIn2> Freeze for Formula<QOut, QIn1, QIn2>
where QIn1: Freeze, QIn2: Freeze,

§

impl<QOut, QIn1 = QOut, QIn2 = f32> !RefUnwindSafe for Formula<QOut, QIn1, QIn2>

§

impl<QOut, QIn1, QIn2> Send for Formula<QOut, QIn1, QIn2>

§

impl<QOut, QIn1, QIn2> Sync for Formula<QOut, QIn1, QIn2>

§

impl<QOut, QIn1, QIn2> Unpin for Formula<QOut, QIn1, QIn2>
where QIn1: Unpin, QIn2: Unpin, QOut: Unpin,

§

impl<QOut, QIn1 = QOut, QIn2 = f32> !UnwindSafe for Formula<QOut, QIn1, QIn2>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more