Skip to content

Ceras 4.0

Latest
Compare
Choose a tag to compare
@rikimaru0345 rikimaru0345 released this 27 Feb 19:12
· 163 commits to master since this release

Major Changes

  • Public properties are now also serialized by default!
    • The default value for config.DefaultTargets has changed from PublicFields to AllPublic
  • TypeConfig:
    • Fluent syntax: config.ConfigType<MyClass>() / .ConfigType(type)
    • Easily config types without attributes
    • config.OnConfigNewType to handle new types (like generics, or also private types)
    • Set a custom IFormatter<> or IFormatterResolver
      • Specify how to construct a class
        • [CerasConstructorAttribute] or .ConfigType<Thing>().ConstructBy(() => new Thing(x, y));
        • Any function can be used! (Many Examples)
        • Automatically maps fields/props to arguments by matching the names
        • You can also map arguments yourself config.ConfigType<MyClass>().MapParameters(...);
  • Debug Report
    • For when you're not sure if/why some field/prop got included or not
    • Use ceras.GenerateSerializationDebugReport(type) to get a report explaining how Ceras will handle the given type, contains information about the used formatter, serialized members, and reasons for inclusion/exclusion.
  • Support for Unity IL2CPP and other AoT platforms
  • Full built-in support for ExpressionTrees!
    • Ceras can fully serialize and deserialize everything in System.Linq.Expressions now!
  • Built-in support for:
    • System.Collections.Immutable.* through an extension nuget package
    • Stack<>, Queue<>
    • System.Drawing.Bitmap and Color
    • BigInteger BitArray, DateTimeOffset, Uri
  • Static Serialization!
    • Easy API ceras.Advanced.SerializeStatic(typeof(YourClassHere));
    • TypeConfig works with static as well: config.ConfigStaticType(typeof(StaticClassTest))
      • Doesn't have to be a static class, you can also configure the static fields of a normal class
    • API will be extended in future versions (since it's still a "preview feature")

Additional Changes

  • SimpleTypeBinder.CustomSearchAssemblies can now be used to specify additional assemblies that should be searched to resolve types
  • You can set CerasBufferPool.Pool to customize how Ceras allocates and discards serialization buffers
  • Ceras now uses "capacity-constructors" for all supported types (like new List<int>(knownSize))
  • Attributes for your own IFormatter<> implementations: [CerasInject] and [CerasNoInject]
  • GetFormatterResolver<>() to obtain one of Ceras' internal resolvers, can be used to force usage of a specific resolver to handle some type.
  • New super-fast formatter: ReinterpretFormatter<T>, used by default for all blittable types
  • Adding a type multiple times to KnownTypes will now tell you which types appear multiple times
  • VerifySizes setting for VersionTolerance, and many general improvements to version tolerance
  • Option to serialize instance delegates
  • EnumAsStringFormatter
  • [Ignore] renamed to [Exclude]

Downloads


Any feedback is always greatly appreciated! 😄