Skip to main content

Sidecar

Trait Sidecar 

Source
pub trait Sidecar {
    // Required method
    fn to_expr(
        &self,
        flow_name: &str,
        location_key: LocationKey,
        location_type: LocationType,
        location_name: &str,
        dfir_ident: &Ident,
    ) -> Expr;

    // Provided method
    fn edit_as_code_options(&self, options: &mut AsCodeOptions) { ... }
}
Expand description

Used to add a sidecar to generated code.

Required Methods§

Source

fn to_expr( &self, flow_name: &str, location_key: LocationKey, location_type: LocationType, location_name: &str, dfir_ident: &Ident, ) -> Expr

Generates code to create a sidecar.

The generated code should be an expression which evaluates as a Future.

Provided Methods§

Source

fn edit_as_code_options(&self, options: &mut AsCodeOptions)

Available on crate feature build only.

Edits the AsCodeOptions which will later be used when generating the DFIR code for each location this sidecar is attached to.

For example, a metrics-recording sidecar can use this to opt in to (otherwise disabled) runtime metrics tracking, via AsCodeOptions::include_metrics_tracking.

The default implementation makes no changes.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Sidecar for RecordMetricsSidecar

Available on crate feature telemetry_emf only.