FactHelper

Struct FactHelper 

Source
pub struct FactHelper;
Expand description

Helper functions for working with fact objects

Implementations§

Source§

impl FactHelper

Source

pub fn create_object(pairs: Vec<(&str, Value)>) -> Value

Create a generic object with key-value pairs

Source

pub fn create_user( name: &str, age: i64, email: &str, country: &str, is_vip: bool, ) -> Value

Create a User fact from common fields

Source

pub fn create_product( name: &str, price: f64, category: &str, in_stock: bool, stock_count: i64, ) -> Value

Create a Product fact

Source

pub fn create_order( id: &str, user_id: &str, total: f64, item_count: i64, status: &str, ) -> Value

Create an Order fact

Source

pub fn create_test_car( speed_up: bool, speed: f64, max_speed: f64, speed_increment: f64, ) -> Value

Create a TestCar object for method call demo

Source

pub fn create_distance_record(total_distance: f64) -> Value

Create a DistanceRecord object for method call demo

Source

pub fn create_transaction( id: &str, amount: f64, location: &str, timestamp: i64, user_id: &str, ) -> Value

Create a Transaction fact for fraud detection

Auto Trait Implementations§

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, 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, 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.