#![cfg_attr(
feature = "async",
doc = r#"
# Async example
```no_run
use caretly::{Client, Format, RenderOptions};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::builder().api_key("zpl_test_...").build()?;
let pdf = client.render_pdf("^XA^FO50,50^A0N,40^FDHello^FS^XZ").await?;
println!("{} page(s), {} label(s) billed", pdf.page_count, pdf.labels_billed.unwrap_or(0));
pdf.save("label.pdf")?;
let png = client
.render("^XA^FO50,50^A0N,40^FDHello^FS^XZ", RenderOptions::new().format(Format::Png).page(1))
.await?;
png.save("label.png")?;
Ok(())
}
```
"#
)]
#![cfg_attr(
feature = "blocking",
doc = r#"
# Blocking example
```no_run
use caretly::blocking::Client;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new()?; // reads CARETLY_API_KEY
let pdf = client.render_pdf("^XA^FO50,50^A0N,40^FDHello^FS^XZ")?;
pdf.save("label.pdf")?;
Ok(())
}
```
"#
)]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![warn(missing_docs)]
#![cfg_attr(
not(any(feature = "async", feature = "blocking")),
allow(dead_code, unused_imports, unused_macros)
)]
mod error;
mod options;
mod result;
mod shared;
#[cfg(feature = "async")]
mod client;
#[cfg(feature = "blocking")]
#[cfg_attr(docsrs, doc(cfg(feature = "blocking")))]
pub mod blocking;
#[cfg(feature = "async")]
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
pub use client::{Client, ClientBuilder};
pub use error::{ApiError, BoxError, Error, Result};
pub use options::{Dpmm, Format, RenderOptions, MAX_IDEMPOTENCY_KEY_LEN};
pub use result::{RateLimit, RenderResult};
#[cfg(all(doctest, feature = "async", feature = "blocking"))]
#[doc = include_str!("../README.md")]
pub struct ReadmeDoctests;