conjure_core::stats

Struct RewriterStats

Source
pub struct RewriterStats {
    pub is_optimization_enabled: Option<bool>,
    pub rewriter_run_time: Option<Duration>,
    pub rewriter_rule_application_attempts: Option<usize>,
    pub rewriter_rule_applications: Option<usize>,
}
Expand description

Represents the statistical data collected during the model rewriting process.

The RewriterStats struct is used to track various metrics and statistics related to the rewriting of a model using a set of rules. These statistics can be used for performance monitoring, debugging, and optimization purposes. The structure supports optional fields, allowing selective tracking of data without requiring all fields to be set.

The struct uses the following features:

  • #[skip_serializing_none]: Skips serializing fields that have a value of None, resulting in cleaner JSON output.
  • #[serde(rename_all = "camelCase")]: Uses camelCase for all serialized field names, adhering to common JSON naming conventions.

§Fields

  • is_optimization_enabled:

    • Type: Option<bool>
    • Indicates whether optimizations were enabled during the rewriting process.
    • If Some(true), it means optimizations were enabled.
    • If Some(false), optimizations were explicitly disabled.
    • If None, the status of optimizations is unknown or not tracked.
  • rewriter_run_time:

    • Type: Option<std::time::Duration>
    • The total runtime duration of the rewriter in the current session.
    • If set, it indicates the amount of time spent on rewriting, measured as a Duration.
    • If None, the runtime is either unknown or not tracked.
  • rewriter_rule_application_attempts:

    • Type: Option<usize>
    • The number of rule application attempts made during the rewriting process.
    • An attempt is counted each time a rule is evaluated, regardless of whether it was successfully applied.
    • If None, this metric is not tracked or not applicable for the current session.
  • rewriter_rule_applications:

    • Type: Option<usize>
    • The number of successful rule applications during the rewriting process.
    • A successful application means the rule was successfully applied to transform the expression or constraint.
    • If None, this metric is not tracked or not applicable for the current session.

§Example

let stats = RewriterStats { is_optimization_enabled: Some(true), rewriter_run_time: Some(std::time::Duration::new(2, 0)), rewriter_rule_application_attempts: Some(15), rewriter_rule_applications: Some(10), };

// Serialize the stats to JSON let serialized_stats = serde_json::to_string(&stats).unwrap(); println!(“Serialized Stats: {}”, serialized_stats);

§Usage Notes

  • This struct is intended to be used in contexts where tracking the performance and behavior of rule-based rewriting systems is necessary. It is designed to be easily serialized and deserialized to/from JSON, making it suitable for logging, analytics, and reporting purposes.

§See Also

Fields§

§is_optimization_enabled: Option<bool>§rewriter_run_time: Option<Duration>§rewriter_rule_application_attempts: Option<usize>§rewriter_rule_applications: Option<usize>

Trait Implementations§

Source§

impl Clone for RewriterStats

Source§

fn clone(&self) -> RewriterStats

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for RewriterStats

Source§

fn default() -> RewriterStats

Returns the “default value” for a type. Read more
Source§

impl JsonSchema for RewriterStats

Source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(gen: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for RewriterStats

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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