]> git.proxmox.com Git - perlmod.git/commitdiff
documentation update
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 25 Nov 2021 09:24:10 +0000 (10:24 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 25 Nov 2021 09:24:10 +0000 (10:24 +0100)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
README.md
perlmod/src/lib.rs

index c608542afe31455ca6cd48e46ddff68c69dc14df..8bee33145c81ffe907813d2bc131be8b2fe5ad6b 100644 (file)
--- a/README.md
+++ b/README.md
@@ -53,10 +53,6 @@ Pending Changes before 1.0
   files, we only need to call bootstrap functions after all.
   (So we may not even need to parse the rust code, rather, just provide a list
   of perl packages to create...)
-* Add prototypes to exported functions.
-* Allow "trailing" `Option` parameters to be skipped in perl.
-  eg. `fn foo(x: u32, y: Option<u32>);` should be callable as `foo(1)`, rather than requiring
-  `foo(1, undef)`.
 
 Current recommended usage.
 ==========================
index 55f0d96f18f96fe2568539fd440cf958bf4b668d..e23d2f98c95d3c9e539a607e72e9a8a153bf4046 100644 (file)
@@ -70,9 +70,21 @@ pub use perlmod_macro::package;
 /// Attribute to export a function so that it can be installed as an `xsub` in perl. See the
 /// [`package!`](macro@package) macro for a usage example.
 ///
-/// This macro can optionally take a `raw_return` argument specifying that the return type, which
-/// must be a [`Value`], will be returned as is, and not go through serialization. As of perlmod
-/// 0.6, serialization of a [`Value`] will not produce a clone, so this is mostly an optimization.
+/// This macro has the following optional arguments:
+///
+/// * `raw_return`: specifies that the return type, which must be a [`Value`], will be returned as
+///   is, and not go through serialization. As of perlmod
+///   0.6, serialization of a [`Value`] will not produce a clone, so this is mostly an
+///   optimization.
+/// * `prototype`: The perl prototype for the function. By default, this will be guessed from the
+///   parameters as a chain of '$', with trailing `Option<>` parameters behind a `;`. So for
+///   example, an `fn(i32, Option<i32>, i32, Option<i32>)` has the prototype `$$$;$`.
+/// * `xs_name`: override the name of the exported xsub, this is not recommended and only makes
+///   sense when *not* using the `#[package]` macro, as with the `#[package]` macro, these aren't
+///   publicly visible.
+/// * `name`: the name the function should be using in perl. This only makes sense with the
+///   `#[package]` macro, as otherwise the user is responsible for loading the function via perl's
+///   `DynaLoader` on their own.
 ///
 /// Additionally, function parameters can also use the following attributes:
 ///