pub trait CostModel: Send + Sync {
// Required methods
fn gate_cost(&self, gate: &dyn GateOp) -> f64;
fn circuit_cost_from_gates(&self, gates: &[Box<dyn GateOp>]) -> f64;
fn weights(&self) -> CostWeights;
fn is_native(&self, gate: &dyn GateOp) -> bool;
// Provided method
fn gates_cost(&self, gates: &[Box<dyn GateOp>]) -> f64 { ... }
}Expand description
Trait for cost models
Required Methods§
Sourcefn circuit_cost_from_gates(&self, gates: &[Box<dyn GateOp>]) -> f64
fn circuit_cost_from_gates(&self, gates: &[Box<dyn GateOp>]) -> f64
Calculate the total cost of a circuit (using gate list)
Sourcefn weights(&self) -> CostWeights
fn weights(&self) -> CostWeights
Get the weights used in cost calculation
Provided Methods§
Sourcefn gates_cost(&self, gates: &[Box<dyn GateOp>]) -> f64
fn gates_cost(&self, gates: &[Box<dyn GateOp>]) -> f64
Calculate the total cost of a list of gates (alias for circuit_cost_from_gates)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".