Serializer

trait Serializer[-R, -T]

Serializer from values of some type T to a byte array

Type parameters:
R

Environment available to the serializer

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

Value members

Abstract methods

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

Concrete methods

def asOption[U <: T](implicit ev: Null <:< T): Serializer[R, Option[U]]

Returns a new serializer that handles optional values and serializes them as nulls.

Returns a new serializer that handles optional values and serializes them as nulls.

def blocking: Serializer[R, T]

Returns a new serializer that executes its serialization function on the blocking threadpool.

Returns a new serializer that executes its serialization function on the blocking threadpool.

def contramap[U](f: U => T): Serializer[R, U]

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

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

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

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

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