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
//! FFI (Foreign Function Interface) module for C/C++ bindings
//!
//! This module provides C-compatible functions that enable the webpage quality analyzer
//! to be used from C and C++ applications with 100% feature parity.
//!
//! # Architecture
//!
//! The FFI layer uses three-tier architecture:
//! 1. **Rust Core** (`src/lib.rs`) - Async API with tokio
//! 2. **FFI Boundary** (`src/ffi/`) - C-compatible blocking wrappers
//! 3. **C++ Wrapper** (`bindings/cpp/`) - RAII classes and exceptions
//!
//! # Safety
//!
//! All FFI functions follow these safety rules:
//! - Null pointers are checked and return error codes
//! - Memory is managed through explicit alloc/free functions
//! - Strings use null-terminated C strings (const char*)
//! - Errors are stored thread-locally and retrieved via getters
//!
//! # Example Usage (C)
//!
//! ```c
//! CReport* report = wqa_analyze("https://example.com", NULL);
//! if (report) {
//! float score = wqa_report_get_score(report);
//! printf("Score: %.2f\n", score);
//! wqa_free_report(report);
//! }
//! ```
// Re-export main types for convenience
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use ;
pub use *;
pub use *;
pub use *;
pub use *;