pub enum PostProcessor {
TickConvertor(TickPostProcessor),
}Expand description
Represents different strategies for post-processing signal values.
The PostProcessor enum encapsulates different algorithms for transforming
signal values after they have been processed from source data. Each variant
contains its own configuration parameters.
§Variants
TickConvertor- Converts values to specific tick sizes
§Examples
Creating a tick convertor post-processor:
use bothan_lib::registry::post_processor::{PostProcessor, tick::TickPostProcessor};
use serde_json::json;
// Create a post-processor from JSON
let json_data = json!({
"function": "tick_convertor",
"params": {}
});
let post_processor: PostProcessor = serde_json::from_value(json_data).unwrap();
assert_eq!(post_processor.name(), "tick_convertor");Using a post-processor:
use bothan_lib::registry::post_processor::{PostProcessor, tick::TickPostProcessor};
use rust_decimal::Decimal;
// Create a tick convertor post-processor
let post_processor = PostProcessor::TickConvertor(TickPostProcessor {});
// Apply the post-processor to a value
let value = Decimal::new(1234, 0);
let result = post_processor.post_process(value).unwrap();Variants§
TickConvertor(TickPostProcessor)
Tick convertor that adjusts values to specific tick sizes.
Implementations§
Source§impl PostProcessor
impl PostProcessor
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Returns the name of the post-processor.
This method returns a string identifier for the post-processor type, which can be used for logging, debugging, or serialization purposes.
Sourcepub fn post_process(&self, data: Decimal) -> Result<Decimal, PostProcessError>
pub fn post_process(&self, data: Decimal) -> Result<Decimal, PostProcessError>
Applies the post-processor to a value.
This method applies the post-processor’s transformation algorithm to the input value to produce a transformed output value.
§Errors
Returns a PostProcessError if the transformation operation fails, such as when:
- The input value is invalid for the transformation
- A mathematical error occurs during transformation
Trait Implementations§
Source§impl<'__de, __Context> BorrowDecode<'__de, __Context> for PostProcessor
impl<'__de, __Context> BorrowDecode<'__de, __Context> for PostProcessor
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 PostProcessor
impl Clone for PostProcessor
Source§fn clone(&self) -> PostProcessor
fn clone(&self) -> PostProcessor
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PostProcessor
impl Debug for PostProcessor
Source§impl<__Context> Decode<__Context> for PostProcessor
impl<__Context> Decode<__Context> for PostProcessor
Source§impl<'de> Deserialize<'de> for PostProcessor
impl<'de> Deserialize<'de> for PostProcessor
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 PostProcessor
impl Encode for PostProcessor
Source§impl PartialEq for PostProcessor
impl PartialEq for PostProcessor
Source§impl Serialize for PostProcessor
impl Serialize for PostProcessor
impl StructuralPartialEq for PostProcessor
Auto Trait Implementations§
impl Freeze for PostProcessor
impl RefUnwindSafe for PostProcessor
impl Send for PostProcessor
impl Sync for PostProcessor
impl Unpin for PostProcessor
impl UnwindSafe for PostProcessor
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