Creates a new instance of this class with the given function that performs the custom serialization.
See Implementation
Creates a new instance of this class with the given function that performs the custom serialization.