From 01e42d23e603a453726141d75d5f34c02710eadd Mon Sep 17 00:00:00 2001 From: Peter Taoussanis Date: Fri, 8 Sep 2023 09:54:16 +0200 Subject: [PATCH] [new] [#160] Add more info to `*freeze-fallback*` docstring --- src/taoensso/nippy.clj | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/taoensso/nippy.clj b/src/taoensso/nippy.clj index 626671fc..f202f69b 100644 --- a/src/taoensso/nippy.clj +++ b/src/taoensso/nippy.clj @@ -350,7 +350,28 @@ ;; For back compatibility (nb Timbre's Carmine appender) (enc/defonce ^:dynamic ^:no-doc ^:deprecated *final-freeze-fallback* "DEPRECATED: prefer `*freeze-fallback`." nil) -(enc/defonce ^:dynamic *freeze-fallback* "(fn [data-output x])->freeze, nil => default" nil) +(enc/defonce ^:dynamic *freeze-fallback* + "Controls Nippy's behaviour when trying to freeze an item for which Nippy + doesn't currently have a native freeze/thaw implementation. + + Possible values: + + 1. `nil` (no freeze-fallback, default) + Tries the following in order: + - Freeze with Java's `Serializable` interface if possible + - Freeze with Clojure's reader if possible + - Throw + + 2. `:write-unfreezable` keyword + Tries the following in order: + - Freeze with Java's `Serializable` interface if possible + - Freeze with Clojure's reader if possible + - Freeze a {:nippy/unfreezable {:type _}} placeholder value + + 3. [Advanced] Custom (fn [^java.io.DataOutput out item]) that must + write exactly one value to the given `DataOutput` stream" + + nil) (enc/defonce ^:dynamic *custom-readers* "{ (fn [data-input])->read}" nil) (enc/defonce ^:dynamic *auto-freeze-compressor*