pub struct OperationRoute {
pub signal_id: String,
pub operation: Operation,
}Expand description
A transformation that applies an operation using a value from another signal.
The OperationRoute struct defines a step in a routing transformation chain.
It specifies a signal whose value should be used as the second operand in
an operation, with the first operand being either the original source value
or the result of previous routing operations.
Routes are applied sequentially, allowing for complex transformations to be built from simple arithmetic operations.
§Examples
use bothan_lib::registry::source::{OperationRoute, Operation};
// Create a route that multiplies by the "USDT-USD" signal's value
let route = OperationRoute::new("USDT-USD", Operation::Multiply);Fields§
§signal_id: StringThe identifier of the signal whose value will be used in the operation.
When this route is applied, the system will look up the current value of the signal with this ID and use it as the second operand in the operation.
operation: OperationThe arithmetic operation to apply.
This defines how the current value will be combined with the value from the referenced signal.
Implementations§
Source§impl OperationRoute
impl OperationRoute
Sourcepub fn new<T: Into<String>>(signal_id: T, operation: Operation) -> Self
pub fn new<T: Into<String>>(signal_id: T, operation: Operation) -> Self
Creates a new operation route.
This constructor creates an operation route that will apply the specified operation using the value of the referenced signal.
§Examples
use bothan_lib::registry::source::{OperationRoute, Operation};
// Create a route that divides by the "USD-EUR" signal's value
let route = OperationRoute::new("USD-EUR", Operation::Divide);Trait Implementations§
Source§impl<'__de, __Context> BorrowDecode<'__de, __Context> for OperationRoute
impl<'__de, __Context> BorrowDecode<'__de, __Context> for OperationRoute
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Source§impl Clone for OperationRoute
impl Clone for OperationRoute
Source§fn clone(&self) -> OperationRoute
fn clone(&self) -> OperationRoute
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OperationRoute
impl Debug for OperationRoute
Source§impl<__Context> Decode<__Context> for OperationRoute
impl<__Context> Decode<__Context> for OperationRoute
Source§impl<'de> Deserialize<'de> for OperationRoute
impl<'de> Deserialize<'de> for OperationRoute
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Encode for OperationRoute
impl Encode for OperationRoute
Source§impl PartialEq for OperationRoute
impl PartialEq for OperationRoute
Source§impl Serialize for OperationRoute
impl Serialize for OperationRoute
impl StructuralPartialEq for OperationRoute
Auto Trait Implementations§
impl Freeze for OperationRoute
impl RefUnwindSafe for OperationRoute
impl Send for OperationRoute
impl Sync for OperationRoute
impl Unpin for OperationRoute
impl UnwindSafe for OperationRoute
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request