]>
Commit | Line | Data |
---|---|---|
ac1ed611 WB |
1 | //! Crate for creating perl packages/bindings for rust code. |
2 | //! | |
2991a46a WB |
3 | //! The main feature of this crate is the [`package`] macro provided by the `perlmod-macro` crate |
4 | //! and documented here. | |
ac1ed611 WB |
5 | //! |
6 | //! The underlying machinery for these macros is contained in this crate and provides ways to | |
7 | //! serialize and deserialize data between perl and rust. | |
8 | //! | |
9 | //! [`package`]: attr.package.html | |
10 | //! [`export`]: attr.export.html | |
ac1ed611 | 11 | |
f7cc8c37 | 12 | pub(crate) mod error; |
87c10237 | 13 | pub use error::Error; |
f7cc8c37 | 14 | |
89989b0f WB |
15 | #[macro_use] |
16 | mod macros; | |
17 | ||
f7cc8c37 WB |
18 | pub mod de; |
19 | pub mod ffi; | |
20 | pub mod ser; | |
21 | ||
22 | #[doc(inline)] | |
dd7f83c3 | 23 | pub use de::{from_ref_value, from_value}; |
f7cc8c37 WB |
24 | #[doc(inline)] |
25 | pub use ser::to_value; | |
26 | ||
27 | pub mod scalar; | |
28 | #[doc(inline)] | |
29 | pub use scalar::{Mortal, Scalar}; | |
30 | ||
31 | pub mod array; | |
32 | #[doc(inline)] | |
33 | pub use array::Array; | |
34 | ||
35 | pub mod hash; | |
36 | #[doc(inline)] | |
37 | pub use hash::Hash; | |
38 | ||
39 | pub mod value; | |
40 | #[doc(inline)] | |
41 | pub use value::Value; | |
42 | ||
43 | #[cfg(feature = "exporter")] | |
42f7a45b | 44 | #[doc(inline)] |
7de9fdf0 WB |
45 | pub use perlmod_macro::package; |
46 | ||
47 | #[cfg(feature = "exporter")] | |
48 | #[doc(inline)] | |
49 | /// Attribute to export a function so that it can be installed as an `xsub` in perl. See the | |
50 | /// [`package!`](macro@package) macro for a usage example. | |
51 | /// | |
52 | /// This macro can optionally take a `raw_return` argument specifying that the return type, which | |
53 | /// must be a [`Value`], will be returned as is, and not go through serialization. | |
54 | /// | |
55 | /// Additionally, function parameters can also use the following attributes: | |
56 | /// | |
57 | /// * `#[raw]` with a parameter of type [`Value`]: The parameter will be passed as | |
58 | /// is and not go through deserialization. | |
59 | /// * `#[try_from_ref]`: Instead of regular deserialization, `TryFrom::try_from(&Value)` will be | |
60 | /// used. | |
61 | /// | |
62 | /// Implementing the `TryFrom` trait accordingly can make using blessed references more | |
63 | /// convenient, but at the cost of hiding underlying `unsafe` code. | |
64 | pub use perlmod_macro::export; |