71 Commits

Author SHA1 Message Date
Wolfgang Bumiller
fee0609d38 bump perlmod to 0.3.0
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-15 16:06:18 +01:00
Wolfgang Bumiller
aabc6479bb "fix" the destructor macro
long story short: compiler restrictions

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-15 15:48:18 +01:00
Wolfgang Bumiller
6dd6718b6e bump perlmod and perlmod-macro to 0.2.3
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-15 14:56:17 +01:00
Wolfgang Bumiller
e077d87d8c fix 'undef' deserialization
Since it has 0 flags it wasn't recognized as a scalar, but
an unsupported "magic" value.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-15 14:54:42 +01:00
Wolfgang Bumiller
fa4d4a654c macro: make generated helpers #[doc(hidden)]
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-15 14:05:02 +01:00
Wolfgang Bumiller
d7f59334ba bump perlmod-macro to 0.2.2-1 as well
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-15 10:36:52 +01:00
Wolfgang Bumiller
fcd20b781a bump perlmod to 0.2.2-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-15 10:14:45 +01:00
Wolfgang Bumiller
7de9fdf07b introduce try_from_ref argument attribute
and document attributes in the #[export] macro documentation

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-27 15:35:08 +01:00
Wolfgang Bumiller
63af6eebc9 bump perlmod to 0.2.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-27 14:35:48 +01:00
Wolfgang Bumiller
35b138f2c6 support deserializing borrowed strings
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-27 13:38:49 +01:00
Wolfgang Bumiller
0bab1226bb bump perlmod-macro to 0.2.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-27 13:07:03 +01:00
Wolfgang Bumiller
241e69eed8 guard '-L./target/debug' lib path by debug_assertions
A release build shouldn't add the local search path for
libraries to the perl modules.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-27 13:03:46 +01:00
Wolfgang Bumiller
81e9f75763 clippy lints
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-27 12:06:01 +01:00
Wolfgang Bumiller
f483228623 bump perlmod and perlmod-macro to 0.2.0
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-26 13:58:17 +01:00
Wolfgang Bumiller
dd7f83c3ee deserialize by reference
Allow deserializing things such as `&[u8]` to reference the
original data instead of requiring a `Vec<u8>` instead.

Introduces `perlmod::from_ref_value` next to
`perlmod::from_value` with a new signature.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-26 13:50:07 +01:00
Wolfgang Bumiller
755df92f64 make Serializer and Deserializer private
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-26 13:29:34 +01:00
Wolfgang Bumiller
144831b5ae allow constants for class names in destructor macro
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-26 11:57:28 +01:00
Wolfgang Bumiller
89989b0f56 destructor macro and helpers for blessed objects
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-26 11:50:16 +01:00
Wolfgang Bumiller
83147b1189 make SvPVbyte safe
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-26 10:21:44 +01:00
Wolfgang Bumiller
ccde914a4c add 'pseudo_block' helper
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-26 09:30:47 +01:00
Wolfgang Bumiller
1182e7f5d7 yet another set of doc fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-25 16:40:51 +01:00
Wolfgang Bumiller
8a062e94c3 more doc improvements
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-25 15:13:57 +01:00
Wolfgang Bumiller
4bb84e440f more doc updates
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-25 15:00:34 +01:00
Wolfgang Bumiller
204bff669b doc example for bless
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-25 14:57:10 +01:00
Wolfgang Bumiller
2991a46a31 fix #[export(name=...)], drop deprecated make_package
The `make_package` macro is tedious to use. We now simply
depend on new-enough rustc for `package` to work.

The change to #[export] allows writing:

    #[export(name = "DESTROY")]
    fn destroy(#[raw] this: Value) { ... }

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-25 14:35:34 +01:00
Wolfgang Bumiller
ca00cfcc9a nicer test for bless
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-25 12:23:34 +01:00
Wolfgang Bumiller
c837c7cc3b add pv_ref, drop unsafe from pv_raw
pv_raw itself doesn't actually dereference the pointer and
performs the necessary checks to not be considered unsafe
per se, the `pv_ref()` and `pv_mut_ref()` method now returns
a mutable reference.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-25 12:12:31 +01:00
Wolfgang Bumiller
0eebb7e1d9 Value: add bless_sv method for convenience
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-25 12:06:50 +01:00
Wolfgang Bumiller
e62be4a750 introduce raw pointer types
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-25 12:02:32 +01:00
Wolfgang Bumiller
f3127578ad destructors work...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-24 11:18:36 +01:00
Wolfgang Bumiller
3348e1b840 perl namespacing, since we can bless now
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-24 11:13:55 +01:00
Wolfgang Bumiller
913a8a72ce support functions without return values
this makes for surprisingly ugly code

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-24 11:05:55 +01:00
Wolfgang Bumiller
0cdb12e277 add support for raw parameters
#[export]
    fn foo(#[raw] this: Value) -> Result<(), Error>;

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-24 10:36:03 +01:00
Wolfgang Bumiller
29e61fa65e add 'raw_return' function attribute
A function declared with a raw_return attribute like this:

    #[export(raw_return)]
    fn foo() -> Result<Value, Error>;

will not perform serialization on the 'Value', but return
the "raw" value to perl. This allows returning blessed
values.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-24 09:37:59 +01:00
Wolfgang Bumiller
568aba2b75 fix export() attribute arg parsing
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-24 09:23:12 +01:00
Wolfgang Bumiller
87c102370e add methods to 'bless' values
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-23 15:51:50 +01:00
Wolfgang Bumiller
5d716926a8 remove .buildbot.yml again
we'll do this later

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-20 14:30:16 +01:00
Wolfgang Bumiller
906b95b1de add 'make builddeps' and .buildbot.yml
we provide our own `make builddeps` now

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-20 14:24:20 +01:00
Wolfgang Bumiller
245289bd28 bump version to 0.1.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-20 13:55:36 +01:00
Wolfgang Bumiller
7929a4b22e perlmod: build.rs: add dh-cargo lines
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-20 13:54:59 +01:00
Wolfgang Bumiller
a777421e5e include version in perlmod-macro dependency
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-20 13:54:59 +01:00
Wolfgang Bumiller
54fd53e1f7 buildsys: Makefile and build.sh like in proxmox crate
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-20 13:54:59 +01:00
Wolfgang Bumiller
46d6d8fa6e perlmod & macro: debian/
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-20 13:54:59 +01:00
Wolfgang Bumiller
2a28e41e86 add description to Cargo.toml files
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-20 09:45:25 +01:00
Wolfgang Bumiller
893f7299f0 remove use of anyhow in doctest
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-20 09:45:25 +01:00
Wolfgang Bumiller
38d6ba9a55 perlmod itself doesn't actually use anyhow
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-20 09:18:00 +01:00
Wolfgang Bumiller
9525acd643 add some function name mangling to xs exports
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-10-16 11:08:50 +02:00
Wolfgang Bumiller
2290f60a05 sort
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-10-16 10:55:54 +02:00
Wolfgang Bumiller
fb6b493d63 switch from failure to anyhow
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-04-20 12:38:49 +02:00
Wolfgang Bumiller
40e6b9d999 fix badges
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-28 09:35:33 +01:00