Skip to content

Scala macros for compile-time generation of Kryo serializers

License

Notifications You must be signed in to change notification settings

nau/kryo-macros

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kryo Macros Build Status Coverage Status version

Macros that generate com.esotericsoftware.kryo.Serializer implementations in compile time, based on compile time reflection.

How to use

Add the following resolver

resolvers += Resolver.bintrayRepo("evolutiongaming", "maven")

Add the library to your dependencies list

libraryDependencies += "com.evolutiongaming" %% "kryo-macros" % "1.0.0"

Generate some serializers for your case classes

import com.evolutiongaming.kryo.Serializer

case class Player(name: String)

val serializer = Serializer.make[Player]

That's it! You have generated a com.esotericsoftware.kryo.Serializer implementation for your Player. You must know what to do with it if you are here :)

How to see generated code

Just add the following line to your sbt build file

scalaOptions += "-Xmacro-settings:print-serializers"

Limitations

  • Only case classes supported
  • No mutable Map's as class fields supported

Examples

For more examples, please, check out SerializerMacroSpec

About

Scala macros for compile-time generation of Kryo serializers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Scala 100.0%