From 761fcac4df8b4eebd56aeda251cd6f381b0e5dbe Mon Sep 17 00:00:00 2001 From: Peter Taoussanis Date: Thu, 23 Jun 2022 13:15:58 +0200 Subject: [PATCH] [Change] Improve tools ns docstrings --- src/taoensso/nippy/tools.clj | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/taoensso/nippy/tools.clj b/src/taoensso/nippy/tools.clj index 2d39cbaa..09bfa5aa 100644 --- a/src/taoensso/nippy/tools.clj +++ b/src/taoensso/nippy/tools.clj @@ -14,7 +14,9 @@ (defn wrap-for-freezing "Ensures that given arg (any freezable data type) is wrapped so that (tools/freeze ) will serialize as - (nippy/freeze )." + (nippy/freeze ). + + See also `nippy.tools/freeze`, `nippy.tools/thaw`." ([x ] (wrap-for-freezing x nil)) ([x opts] (if (instance? WrappedForFreezing x) @@ -25,7 +27,13 @@ (WrappedForFreezing. x opts)))) (defn freeze - "Like `nippy/freeze` but merges opts from *freeze-opts*, `wrap-for-freezing`." + "Like `nippy/freeze` but uses as opts the following merged in order of + ascending preference: + + - Optional `default-opts` arg given to this fn (default nil). + - Optional `*freeze-opts*` dynamic value (default nil). + - Optional opts provided to `wrap-for-freezing` (default nil)." + ([x ] (freeze x nil)) ([x default-opts] (let [default-opts (get default-opts :default-opts default-opts) ; For back compatibility @@ -37,7 +45,12 @@ (nippy/freeze x merged-opts))))) (defn thaw - "Like `nippy/thaw` but merges opts from `*thaw-opts*`." + "Like `nippy/thaw` but uses as opts the following merged in order of + ascending preference: + + - Optional `default-opts` arg given to this fn (default nil). + - Optional `*thaw-opts*` dynamic value (default nil)." + ([ba ] (thaw ba nil)) ([ba default-opts] (let [default-opts (get default-opts :default-opts default-opts) ; For back compatibility