1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//! Raw FFI bindings for the [cpdb-libs](https://github.com/OpenPrinting/cpdb-libs)
//! C library (Common Print Dialog Backends).
//!
//! # Overview
//!
//! `cpdb-sys` is the low-level foundation of the `cpdb-rs` workspace. It
//! uses [`bindgen`](https://crates.io/crates/bindgen) to generate Rust
//! declarations for every C function, type, and constant exposed by
//! `libcpdb` and `libcpdb-frontend`, and wraps them in thin, safe-ish
//! Rust modules.
//!
//! **Most Rust users should depend on [`cpdb-rs`](https://crates.io/crates/cpdb-rs)
//! instead**, either with the `zbus-backend` feature (async, pure-Rust,
//! zero C dependencies) or the `ffi` feature (which re-exports this crate).
//! Reach for `cpdb-sys` directly only when you need access to a C symbol
//! that the higher-level crate hasn't wrapped yet.
//!
//! # Module structure
//!
//! | Module | Contents |
//! |--------|----------|
//! | [`bindings`] | Raw auto-generated `bindgen` output - all `unsafe` |
//! | [`callbacks`] | Safe closure trampolines for `cpdb_printer_callback` and `cpdb_async_callback` |
//! | [`common`] | Helpers for paths, config dirs, and library init (`cpdbInit`) |
//! | [`error`] | [`error::CpdbError`] enum and `Result` alias used by all modules |
//! | [`frontend`] | Safe wrapper around `cpdb_frontend_obj_t` |
//! | [`options`] | [`options::OptionsCollection`] - owned snapshot of a printer's capabilities |
//! | [`printer`] | Safe wrapper around `cpdb_printer_obj_t` |
//! | [`settings`] | Safe wrapper around `cpdb_settings_t` |
//! | [`util`] | Internal C-string helpers and `COptions` array builder |
//!
//! All raw C symbols (functions, types, constants) are additionally
//! re-exported at the crate root via `pub use bindings::*`, so you can
//! write `cpdb_sys::cpdbInit()` instead of `cpdb_sys::bindings::cpdbInit()`.
//!
//! # Safety
//!
//! Everything in [`bindings`] is `unsafe`. The higher-level modules
//! (`frontend`, `printer`, `settings`, ...) encapsulate the most common
//! usage patterns behind safe APIs, but they cannot prevent all misuse -
//! read each module's documentation carefully before calling into the C
//! library directly.
//!
//! # Build requirements
//!
//! `cpdb-sys` links against `libcpdb` and `libcpdb-frontend`. Install
//! the development headers before building:
//!
//! ```text
//! # Debian / Ubuntu
//! sudo apt install libcpdb-dev
//!
//! # Fedora / RHEL
//! sudo dnf install cpdb-libs-devel
//! ```
//!
//! Set `CPDB_LIBS_PATH=<prefix>` if the library is installed to a
//! non-standard location where `pkg-config` cannot find it.
pub use *;