attributeSerializer

fun <T> attributeSerializer(key: <Error class: unknown class><T>, save: SaverScope.(value: T) -> Any?, restore: (value: Any) -> T?): AttributeSerializer<T>

Creates an AttributeSerializer using functional save and restore lambdas.

Parameters

key

The AttributeKey to serialize and deserialize.

save

Lambda describing how to serialize an instance of T.

restore

Lambda describing how to restore an instance of T from the saved representation.