Deserializer

trait Deserializer[-R, +T]

Deserializer from byte array to a value of some type T

Type parameters:
R

Environment available to the deserializer

T

Value type

Companion:
object
class Object
trait Matchable
class Any
trait Serde[R, T]

Value members

Abstract methods

def deserialize(topic: String, headers: Headers, data: Array[Byte]): RIO[R, T]

Concrete methods

def asOption(implicit @nowarn ev: T <:< AnyRef): Deserializer[R, Option[T]]

Returns a new deserializer that deserializes values as Option values, mapping null data to None values.

Returns a new deserializer that deserializes values as Option values, mapping null data to None values.

def asTry: Deserializer[R, Try[T]]

Serde that handles deserialization failures by returning a Task

Serde that handles deserialization failures by returning a Task

This is useful for explicitly handling deserialization failures.

Returns a new deserializer that executes its deserialization function on the blocking threadpool.

Returns a new deserializer that executes its deserialization function on the blocking threadpool.

def map[U](f: T => U): Deserializer[R, U]

Create a deserializer for a type U based on the deserializer for type T and a mapping function

Create a deserializer for a type U based on the deserializer for type T and a mapping function

def mapM[R1 <: R, U](f: T => RIO[R1, U]): Deserializer[R1, U]

Create a deserializer for a type U based on the deserializer for type T and an effectful mapping function

Create a deserializer for a type U based on the deserializer for type T and an effectful mapping function

def orElse[R1 <: R, U >: T](alternative: Deserializer[R1, U]): Deserializer[R1, U]

When this serializer fails, attempt to deserialize with the alternative

When this serializer fails, attempt to deserialize with the alternative

If both deserializers fail, the error will be the last deserializer's exception.