Velocypack encoder
VPackEncoder[T]
encodes scala values to VPack values T => VPack
By importing avokka.velocypack._
you bring toVPack
and toVPackBits
to all types T
having an implicit VPackEncoder[T]
:
import avokka.velocypack._
val b: Boolean = true
// b: Boolean = true
b.toVPack
// res0: VPack = VTrue
b.toVPackBits
// res1: Either[VPackError, BitVector] = Right(BitVector(8 bits, 0x1a))
val a: Seq[Int] = List(1,2)
// a: Seq[Int] = List(1, 2)
a.toVPack
// res2: VPack = VArray(Vector(VSmallint(1), VSmallint(2)))
a.toVPackBits
// res3: Either[VPackError, BitVector] = Right(BitVector(32 bits, 0x02043132))