Skip to content

Commit

Permalink
new uid encoder/decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
lh70 committed Jul 30, 2024
1 parent 451216d commit 7d1af04
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Modules/DTN/shared/src/main/scala/dtn/Bundle.scala
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,13 @@ private def readBytes(reader: Reader): Array[Byte] = {
given Codec[RdtMessageType] = deriveCodec[RdtMessageType]
given Codec[RdtMetaInfo] = deriveCodec[RdtMetaInfo]

given Encoder[Uid] = Encoder.forString.asInstanceOf[Encoder[Uid]]
given Decoder[Uid] = Decoder.forString.asInstanceOf[Decoder[Uid]]
given Encoder[Uid] = Encoder { (writer, uid) =>
writer.writeString(uid.toString)
}

given Decoder[Uid] = Decoder { reader =>
Uid(reader.readString())
}

given Encoder[ArrayRanges] = Encoder { (writer, arrayRanges) =>
writer.write[Array[Time]](arrayRanges.inner.slice(0, arrayRanges.used))
Expand Down

0 comments on commit 7d1af04

Please sign in to comment.