88 Commits

Author SHA1 Message Date
Wolfgang Bumiller
b5c53f3d37 improve PVLV handling
For the cases we're most intested in (substr and vivifyable
hash indexing) we can use perform "GET" magic to figure out
whether it was undef or not, and then simply recurse.
We'll have to deal with other cases as we run into them.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-06-10 10:14:04 +02:00
Wolfgang Bumiller
61143f5d12 experimental PVLV support
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-06-08 11:28:01 +02:00
Wolfgang Bumiller
ec6f42c37e bump perlmod to 0.4.3-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-03-09 15:36:52 +01:00
Fabian Ebner
f053fb84ef array: avoid underflow when array is empty and more is zero
serializing an empty array triggered this.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
[rustfmt: Wolfgang Bumiller <w.bumiller@proxmox.com>]
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-03-09 15:32:40 +01:00
Wolfgang Bumiller
dc04b1694f bump d/control
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-23 14:27:00 +01:00
Wolfgang Bumiller
4aee0cb571 bump perlmod to 0.4.2-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-23 14:26:31 +01:00
Wolfgang Bumiller
db22bf8db6 allow PVMG in deserialization
they are supposed to end up being regular scalars after all,
usually

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-23 13:59:48 +01:00
Wolfgang Bumiller
1bb53e8403 bump perlmod-macro to 0.3.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-22 14:18:26 +01:00
Wolfgang Bumiller
f2fb3f9604 check in control files
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-22 14:18:26 +01:00
Wolfgang Bumiller
740eda0643 adjust path for DynaLoader
We usually have multiple packages but only a single library,
so rather than making package look in subdirectories named
after them, just look in the toplevel `auto/` directory.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-22 14:12:25 +01:00
Wolfgang Bumiller
a3361698b3 bump perlmod to 0.4.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-16 12:38:16 +01:00
Wolfgang Bumiller
5504cc2fb5 fix refcount issue in Hash::insert_by_value
The HV takes ownership of the value!

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-16 12:37:26 +01:00
Wolfgang Bumiller
53ad5e5fb6 bump perlmod to 0.4.0-1
to bump the macro dependency by a major version

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-16 10:44:54 +01:00
Wolfgang Bumiller
e95a2c0a23 add test.pl file for a usage example of perlmod-test
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-16 10:42:10 +01:00
Wolfgang Bumiller
d870bc9bb3 bump perlmod-macro to 0.3.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-16 10:41:52 +01:00
Wolfgang Bumiller
705d6989ad macro: support tuple return types in functions
These are now *list* return types in perl.
However, currently there is no support for 'wantarray' or
lists of dynamic length.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-16 10:39:37 +01:00
Wolfgang Bumiller
03644975f4 use try_from_ref in the example
to show how it's used

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-16 10:39:02 +01:00
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