From 25f302f491d5402cc642555a24682f3626c56091 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Fri, 1 May 2020 23:33:01 +0200 Subject: [PATCH] Add is_true --- Cargo.toml | 2 +- src/lib.rs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 009fa195..2bce54ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ authors = [ "Isaiah Inuwa ", "Anthony Ramine ", ] -version = "0.1.2" +version = "0.1.3" repository = "https://github.com/ruma/ruma-serde" edition = "2018" diff --git a/src/lib.rs b/src/lib.rs index b0369f6b..ae83bd69 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,6 +23,13 @@ pub fn default_true() -> bool { true } +/// Simplfy dereferences the given bool. +/// +/// Useful for `#[serde(skip_serializing_if = ...)]` +pub fn is_true(b: &bool) -> bool { + *b +} + /// Serde deserialization decorator to map empty Strings to None, /// and forward non-empty Strings to the Deserialize implementation for T. /// Useful for the typical