public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH perlmod v3 0/2] perlmod: add #[hash] parameter attribute
@ 2026-07-30 11:10 Max R. Carrara
  2026-07-30 11:10 ` [PATCH perlmod v3 1/2] macro: function: move signature inputs handling into helper struct Max R. Carrara
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Max R. Carrara @ 2026-07-30 11:10 UTC (permalink / raw)
  To: pve-devel

perlmod: add #[hash] parameter attribute - v3
=============================================

This series implements a `#[hash]` parameter similar to the existing
`#[list]` one, allowing us to create APIs like
`foo("arg", key => "value")` directly from Rust.

In other words, this essentially mirrors how a sub with `%params` as its
last parameter would work.

For example, this is one of the functions called by the tests that are
added in this series:

    #[export]
    fn trailing_hash(first: u32, #[hash] rest: HashMap<u32, u32>) -> String {
        format!("first={first}, rest is {rest:?}")
    }

This can then be called e.g. like this:

    let $res = TestLib::Hello::trailing_hash(42, 1337 => 123);

Changes Since v2
----------------

- Drop patches that were already applied (thanks!)

- Incorporate Wolfgang's feedback on patch #4 of v2 [0] (thanks a lot!)
  and remove unnecessary bindings and indentation; can now be found in
  patch #1 of this series.

  Changed the commit message correspondingly as well.

- Rebase the very last patch that actually adds support for `#[hash]`
  on top of the previous change.

Previous Versions
-----------------

v1: https://lore.proxmox.com/pve-devel/20260720152541.524463-1-m.carrara@proxmox.com/
v2: https://lore.proxmox.com/pve-devel/20260724144914.658730-1-m.carrara@proxmox.com/

References
----------

[0] https://lore.proxmox.com/pve-devel/20260724144914.658730-1-m.carrara@proxmox.com/T/#mb48037a41330f7ec625a2a2295f9bee0b8b8adcf

Summary of Changes
------------------


perlmod:

Max R. Carrara (2):
  macro: function: move signature inputs handling into helper struct
  perlmod, macro: add #[hash] parameter attribute

 perlmod-macro/src/function.rs | 365 +++++++++++++++++++++++-----------
 perlmod/src/de.rs             |  44 ++++
 perlmod/src/lib.rs            |   5 +
 testlib-tests/01-hello.t      |  46 ++++-
 testlib/src/lib.rs            |  24 ++-
 5 files changed, 367 insertions(+), 117 deletions(-)


Summary over all repositories:
  5 files changed, 367 insertions(+), 117 deletions(-)

-- 
Generated by murpp 0.12.0




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-30 17:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-30 11:10 [PATCH perlmod v3 0/2] perlmod: add #[hash] parameter attribute Max R. Carrara
2026-07-30 11:10 ` [PATCH perlmod v3 1/2] macro: function: move signature inputs handling into helper struct Max R. Carrara
2026-07-30 11:10 ` [PATCH perlmod v3 2/2] perlmod, macro: add #[hash] parameter attribute Max R. Carrara
2026-07-30 17:00 ` [PATCH perlmod v3 0/2] perlmod: " Wolfgang Bumiller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal