]> git.proxmox.com Git - perlmod.git/commitdiff
perlmod: expose ser::is_active
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 25 Mar 2022 14:45:11 +0000 (15:45 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 25 Mar 2022 14:45:15 +0000 (15:45 +0100)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
perlmod/src/ser.rs

index 02d638b95ce241ac1abc81780eb6863c6bdf439a..17f0bcaa9b1c62ef1317064fc4f8e371509c344f 100644 (file)
@@ -9,6 +9,14 @@ use crate::{array, hash, raw_value};
 /// Perl [`Value`](crate::Value) serializer.
 struct Serializer;
 
+/// Check if the `perlmod::Serializer` is currently being used for serialization.
+///
+/// External structs can use this to determine whether serializing a `RawValue` containing an xsub
+/// will be serialized into perl in a meaningful way.
+pub fn is_active() -> bool {
+    raw_value::is_enabled()
+}
+
 /// Serialize data into a perl [`Value`](crate::Value).
 ///
 /// Note that in theory it should be safe to send such values to different threads as long as their