0.1.3 release

This commit is contained in:
Alexander Nozik 2019-08-17 17:10:40 +03:00
parent 27c510f5d0
commit d16d051a1c
2 changed files with 5 additions and 1 deletions

View File

@ -29,7 +29,7 @@ class JoinGroupBuilder<T : Any, R : Any>(val actionMeta: Meta) {
*/ */
fun byValue(tag: String, defaultTag: String = "@default", action: JoinGroup<T, R>.() -> Unit) { fun byValue(tag: String, defaultTag: String = "@default", action: JoinGroup<T, R>.() -> Unit) {
groupRules += { node -> groupRules += { node ->
GroupBuilder.byValue(tag, defaultTag).invoke(node).map { GroupRule.byValue(tag, defaultTag).invoke(node).map {
JoinGroup<T, R>(it.key, it.value).apply(action) JoinGroup<T, R>(it.key, it.value).apply(action)
} }
} }

View File

@ -25,6 +25,7 @@ interface Binary {
/** /**
* A [Binary] with addition random access functionality. It by default allows multiple [read] operations. * A [Binary] with addition random access functionality. It by default allows multiple [read] operations.
*/ */
@ExperimentalUnsignedTypes
interface RandomAccessBinary : Binary { interface RandomAccessBinary : Binary {
/** /**
* Read at most [size] of bytes starting at [from] offset from the beginning of the binary. * Read at most [size] of bytes starting at [from] offset from the beginning of the binary.
@ -39,10 +40,12 @@ fun Binary.readAll(): ByteReadPacket = read {
ByteReadPacket(this.readBytes()) ByteReadPacket(this.readBytes())
} }
@ExperimentalUnsignedTypes
fun RandomAccessBinary.readPacket(from: UInt, size: UInt): ByteReadPacket = read(from, size) { fun RandomAccessBinary.readPacket(from: UInt, size: UInt): ByteReadPacket = read(from, size) {
ByteReadPacket(this.readBytes()) ByteReadPacket(this.readBytes())
} }
@ExperimentalUnsignedTypes
object EmptyBinary : RandomAccessBinary { object EmptyBinary : RandomAccessBinary {
override val size: ULong = 0.toULong() override val size: ULong = 0.toULong()
@ -52,6 +55,7 @@ object EmptyBinary : RandomAccessBinary {
} }
} }
@ExperimentalUnsignedTypes
class ArrayBinary(val array: ByteArray) : RandomAccessBinary { class ArrayBinary(val array: ByteArray) : RandomAccessBinary {
override val size: ULong get() = array.size.toULong() override val size: ULong get() = array.size.toULong()