rigetti / qcs-sdk-rust

Rust SDK for Rigetti Quantum Cloud Services (QCS)
https://docs.rs/qcs
13 stars 5 forks source link

feat: make Executable.get_qcs_client public #380

Closed jselig-rigetti closed 1 year ago

jselig-rigetti commented 1 year ago

Up for debate, but in cases where you need to provide some execution configuration, it would help to use a single source of truth for the qcs client

For example, to use https://github.com/rigetti/qcs-sdk-rust/blob/a4c832ca7360d546a0bd0c71230353f6a4b28eaa/crates/lib/src/executable.rs#L367

Here's what you have to do:

// ... in some other function ...

let exe = qcs::executable::Executable::from_quil("...");

// ... later on ...

// > before this change: who knows if `exe` is configured with
// the same client or if we're doing a redundant load
let qcs_client = qcs::client::Qcs::load().await;

// > after this change: same client, only one load
let qcs_client = exe.get_qcs_client().await;

let qvm_client = qcs::qvm::http::HttpClient::from(&qcs_client);
exe.execute_on_qvm(&qvm_client)