use std::sync::atomic::{AtomicBool, Ordering};
use crate::{embedded::EmbeddedClientBuilder, remote::RemoteClientBuilder};
static PROVER_CLIENT_CREATED: AtomicBool = AtomicBool::new(false);
pub(crate) fn ensure_single_instance() {
if PROVER_CLIENT_CREATED.swap(true, Ordering::AcqRel) {
panic!(
"A ProverClient already exists. Only one instance is allowed per process. \
Store it in a shared location (e.g., Arc<EmbeddedClient> / Arc<RemoteClient>) and reuse it."
);
}
}
pub struct ProverClient;
impl ProverClient {
#[must_use]
pub fn embedded() -> EmbeddedClientBuilder {
EmbeddedClientBuilder::default()
}
#[must_use]
pub fn remote(url: impl Into<String>) -> RemoteClientBuilder {
RemoteClientBuilder::new(url)
}
}