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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//! # AutoZig - Safe Rust to Zig FFI
//!
//! AutoZig enables safe, ergonomic interop between Rust and Zig code.
//!
//! ## Architecture
//!
//! AutoZig follows a three-stage pipeline inspired by autocxx:
//!
//! 1. **Parsing Stage**: Extract Zig code from `autozig!` macro invocations
//! 2. **Build Stage**: Compile Zig to static library (.a) and generate C
//! headers
//! 3. **Binding Stage**: Generate safe Rust wrappers around raw FFI
//!
//! ## Example
//!
//! ```rust,no_run
//! use autozig::prelude::*;
//!
//! autozig! {
//! // Zig implementation
//! const std = @import("std");
//!
//! export fn compute_hash(ptr: [*]const u8, len: usize) u64 {
//! const data = ptr[0..len];
//! var hash: u64 = 0;
//! for (data) |byte| {
//! hash +%= byte;
//! }
//! return hash;
//! }
//!
//! ---
//!
//! // Rust interface (Safe wrapper)
//! fn compute_hash(data: &[u8]) -> u64;
//! }
//!
//! let data = b"Hello AutoZig";
//! let hash = compute_hash(data); // Safe call, no unsafe needed!
//! println!("Hash: {}", hash);
//! ```
// Note: We cannot use #![forbid(unsafe_code)] because the zero_copy module
// requires unsafe for FFI and raw pointer manipulation.
/// Re-export the procedural macros
pub use autozig;
pub use include_zig;
/// Stream support for async Zig FFI
/// Zero-copy buffer passing between Zig and Rust (Phase 4.2)
/// Common imports for using AutoZig
/// Placeholder for Zig type wrappers