pub trait EventFactory: Sized {
type Record: Send;
type Error: Into<EventFactoryError> + Send + 'static;
type CreationData: Clone + Send;
// Required methods
fn try_new(
map: HashMap<String, InputReference>,
setup_data: Self::CreationData,
) -> Result<(Self, Vec<String>), EventFactoryError>;
fn get_event(&self, rec: Self::Record) -> Result<Event, EventFactoryError>;
// Provided method
fn new(
map: HashMap<String, InputReference>,
setup_data: Self::CreationData,
) -> Result<Self, EventFactoryError> { ... }
}Expand description
This trait provides the functionality to pass inputs to the monitor. You can either implement this trait for your own Datatype or use one of the predefined input methods. See MappedFactory, ArrayFactory, and VectorFactory
Required Associated Types§
Sourcetype Error: Into<EventFactoryError> + Send + 'static
type Error: Into<EventFactoryError> + Send + 'static
The error type returned by the input source on IO errors or parsing issues.
Sourcetype CreationData: Clone + Send
type CreationData: Clone + Send
Arbitrary type of the data provided to the input source at creation time.
Required Methods§
Sourcefn try_new(
map: HashMap<String, InputReference>,
setup_data: Self::CreationData,
) -> Result<(Self, Vec<String>), EventFactoryError>
fn try_new( map: HashMap<String, InputReference>, setup_data: Self::CreationData, ) -> Result<(Self, Vec<String>), EventFactoryError>
Construction the input for only a subset of the required input streams. Enables the combination of multiple Input implementors into one.
The returned Vector contains the names of the input streams that can be served by this input.
The constructed input should return Value::None for all inputs that are unknown to it.
Provided Methods§
Sourcefn new(
map: HashMap<String, InputReference>,
setup_data: Self::CreationData,
) -> Result<Self, EventFactoryError>
fn new( map: HashMap<String, InputReference>, setup_data: Self::CreationData, ) -> Result<Self, EventFactoryError>
Creates a new input source from a HashMap mapping the names of the inputs in the specification to their position in the event.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.