From cac2982a8b93aa1716ea3b47fb7af010a4119e7a Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 25 Mar 2022 15:45:11 +0100 Subject: [PATCH] perlmod: expose ser::is_active Signed-off-by: Wolfgang Bumiller --- perlmod/src/ser.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/perlmod/src/ser.rs b/perlmod/src/ser.rs index 02d638b..17f0bca 100644 --- a/perlmod/src/ser.rs +++ b/perlmod/src/ser.rs @@ -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