
ru.tinkoff.phobos.decoding.TextLiteralInstances.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of phobos-core_2.13 Show documentation
Show all versions of phobos-core_2.13 Show documentation
Fast xml data binding library
The newest version!
package ru.tinkoff.phobos.decoding
private[decoding] trait TextLiteralInstances {
implicit def literalDecoder[A, L <: A](implicit decoder: TextDecoder[A], valueOfL: ValueOf[L]): TextDecoder[L] =
decoder
.emap((history, a) =>
if (a == valueOfL.value) Right(valueOfL.value)
else
Left(DecodingError(s"Failed to decode literal type. Expected: ${valueOfL.value}, actual: $a", history, None)),
)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy