Skip to main content

qcs_api_client_common/
lib.rs

1// Copyright 2022 Rigetti Computing
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Implementation code common to the QCS OpenAPI and gRPC clients.
16//!
17//! You probably don't need to use this directly, as the clients should expose anything you might
18//! need.
19//!
20//! # Features
21//!
22//! - `tracing`: enables `tracing` support in [`ClientConfiguration`].
23//! - `tracing-config`: enables [`TracingConfiguration`] support for enabling/disabling traces per-URL.
24//!   Requires the `tracing` feature.
25//! - `python`: enables Python bindings for the client.
26pub mod backoff;
27pub mod configuration;
28pub use configuration::ClientConfiguration;
29
30#[cfg(feature = "clap")]
31pub mod clap_utils;
32
33#[cfg(feature = "tracing-config")]
34pub mod tracing_configuration;
35
36#[cfg(feature = "python")]
37pub mod errors;
38
39#[cfg(feature = "python")]
40use pyo3::prelude::*;
41
42#[cfg(feature = "python")]
43rigetti_pyo3::create_init_submodule! {
44    errors: [ errors::QcsApiClientError ],
45    submodules: ["configuration": configuration::py::init_submodule],
46}
47
48#[cfg(feature = "python")]
49#[pymodule]
50#[pyo3(name = "_qcs_api_client_common")]
51fn init_module(m: &Bound<'_, PyModule>) -> PyResult<()> {
52    init_submodule("qcs_api_client_common", m.py(), m)
53}
54
55#[cfg(feature = "stubs")]
56pyo3_stub_gen::define_stub_info_gatherer!(stub_info);