scalus.serialization.cbor.Cbor
Utility object for CBOR (Concise Binary Object Representation) encoding and decoding operations.
Provides convenient methods for serializing Scala objects to CBOR format and deserializing CBOR data back to Scala objects using the borer library.
Attributes
-
Graph
-
-
Supertypes
-
class Object
trait Matchable
class Any
-
Self type
-
Members list
Decodes CBOR data back to a Scala object of the specified type.
Decodes CBOR data back to a Scala object of the specified type.
Type parameters
-
A
-
the target type to decode to, must have an implicit Decoder available
Value parameters
-
data
-
the CBOR-encoded byte array to decode
Attributes
-
Returns
-
the decoded object of type A
-
Throws
-
io.bullet.borer.Borer.Error
if the data cannot be decoded to the specified type
Encodes a value to CBOR format.
Encodes a value to CBOR format.
This implementation allows KeepRaw to store original CBOR bytes when encoding.
Type parameters
-
A
-
the type of the value, must have an implicit Encoder available
Value parameters
-
value
-
the value to encode
Attributes
-
Returns
-
the CBOR-encoded data as a byte array
-
Note
-
this method uses a workaround to enable storing original CBOR bytes described here