All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.plokhotnyuk.jsoniter_scala.macros.ConfiguredJsonValueCodec.scala Maven / Gradle / Ivy

package com.github.plokhotnyuk.jsoniter_scala.macros

import com.github.plokhotnyuk.jsoniter_scala.core._

/**
 * An extension of `JsonValueCodec[A]` that could be used to derive codecs using the `... derives ...` syntax.
 *
 * A compile-time configuration can be provided by an `inline given CodecMakerConfig` value, which needs to be visible
 * in the scope, and defined/imported before the `... derives ...` syntax usage.
 *
 * To avoid overhead in runtime use it only for top-level and big commonly used data structures.
 */
trait ConfiguredJsonValueCodec[A] extends JsonValueCodec[A]

object ConfiguredJsonValueCodec:
  inline def derived[A](using inline config: CodecMakerConfig = CodecMakerConfig): ConfiguredJsonValueCodec[A] = new:
    private val impl = JsonCodecMaker.make[A](config)
    export impl._




© 2015 - 2025 Weber Informatics LLC | Privacy Policy