pub fn run(
input: &str,
shots: Option<usize>
) -> Result<Execution, QasmSimError<'_>>
Expand description
Parse and simulate the input
OPENQASM program with optional shots
.
Errors
The function can fail if the source code presents an error or something
unexpected happens during the simulation. In this case, an Err
variant
wrapping a value of QasmSimError
is returned.
Examples
Basic usage:
use qasmsim::run;
let execution = run(r#"
OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
"#, None)?;