mirror of
https://git.proxmox.com/git/proxmox-perl-rs
synced 2025-07-10 12:07:53 +00:00
pve-rs: add PVE::RS::CalendarEvent
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
2f474e63f5
commit
e75f545a2f
@ -20,6 +20,7 @@ PM_DIRS := \
|
|||||||
|
|
||||||
PM_FILES := \
|
PM_FILES := \
|
||||||
PVE/RS/APT/Repositories.pm \
|
PVE/RS/APT/Repositories.pm \
|
||||||
|
PVE/RS/CalendarEvent.pm \
|
||||||
PVE/RS/OpenId.pm \
|
PVE/RS/OpenId.pm \
|
||||||
PVE/RS/TFA.pm
|
PVE/RS/TFA.pm
|
||||||
|
|
||||||
|
20
pve-rs/src/calendar_event.rs
Normal file
20
pve-rs/src/calendar_event.rs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#[perlmod::package(name = "${PERLMOD_PRODUCT}::RS::CalendarEvent")]
|
||||||
|
mod export {
|
||||||
|
use anyhow::Error;
|
||||||
|
use perlmod::Value;
|
||||||
|
|
||||||
|
perlmod::declare_magic!(Box<CalendarEvent> : &CalendarEvent as "${PERLMOD_PRODUCT}::RS::CalendarEvent");
|
||||||
|
|
||||||
|
#[repr(transparent)]
|
||||||
|
struct CalendarEvent(proxmox_time::CalendarEvent);
|
||||||
|
|
||||||
|
#[export(raw_return)]
|
||||||
|
fn new(#[raw] class: Value, event: String) -> Result<Value, Error> {
|
||||||
|
Ok(perlmod::instantiate_magic!(&class, MAGIC => Box::new(CalendarEvent(event.parse()?))))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[export]
|
||||||
|
fn compute_next_event(#[try_from_ref] this: &CalendarEvent, last: i64) -> Result<Option<i64>, Error> {
|
||||||
|
this.0.compute_next_event(last)
|
||||||
|
}
|
||||||
|
}
|
@ -5,3 +5,4 @@ pub mod apt;
|
|||||||
|
|
||||||
pub mod openid;
|
pub mod openid;
|
||||||
pub mod tfa;
|
pub mod tfa;
|
||||||
|
pub mod calendar_event;
|
||||||
|
Loading…
Reference in New Issue
Block a user