
ru.tinkoff.phobos.decoding.AttributeLiteralInstances.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 AttributeLiteralInstances {
implicit def literalDecoder[A, L <: A](
implicit decoder: AttributeDecoder[A],
valueOfL: ValueOf[L],
): AttributeDecoder[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