Changeset

12616:6b70d1af1fe3

util.serialization: Add Teal type specification
author Kim Alvefur <zash@zash.se>
date Wed, 01 Dec 2021 15:05:06 +0100
parents 12615:b2047b82ec85
children 12617:36d77cc56ecb
files teal-src/util/serialization.d.tl
diffstat 1 files changed, 33 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/teal-src/util/serialization.d.tl	Wed Dec 01 15:05:06 2021 +0100
@@ -0,0 +1,33 @@
+local record _M
+	enum preset
+		"debug"
+		"oneline"
+		"compact"
+	end
+	type fallback = function (any, string) : string
+	record config
+		preset : preset
+		fallback :  fallback
+		fatal : boolean
+		keywords : { string : boolean }
+		indentwith : string
+		itemstart : string
+		itemsep : string
+		itemlast : string
+		tstart : string
+		tend : string
+		kstart : string
+		kend : string
+		equals : string
+		unquoted : boolean | string
+		hex : string
+		freeze : boolean
+		maxdepth : integer
+		multirefs : boolean
+		table_pairs : function
+	end
+	type serializer = function (any) : string
+	new : function (config|preset) : serializer
+	serialize : function (any, config|preset) : string
+end
+return _M