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

org.virtuslab.yaml.YamlCodecCrossCompat.scala Maven / Gradle / Ivy

There is a newer version: 0.3.0
Show newest version
package org.virtuslab.yaml

import scala.deriving.Mirror

private[yaml] trait YamlCodecCompanionCrossCompat {
  inline def derived[T](using m: Mirror.Of[T]): YamlCodec[T] =
    new YamlCodec[T]:
      val decoder = YamlDecoder.derived[T]
      val encoder = YamlEncoder.derived[T]

      def construct(node: Node)(using
          settings: LoadSettings = LoadSettings.empty
      ): Either[ConstructError, T] = decoder.construct(node)
      def asNode(obj: T): Node = encoder.asNode(obj)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy