All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scodec.DecodeResult.scala Maven / Gradle / Ivy

There is a newer version: 1.11.3
Show newest version
package scodec

import scodec.bits.BitVector

/**
 * Result of a decoding operation, which consists of the decoded value and the remaining bits that were not consumed by decoding.
 *
 * @groupname Ungrouped Members
 * @groupprio 1
 *
 * @groupname combinators Basic Combinators
 * @groupprio combinators 0
 */
final case class DecodeResult[+A](value: A, remainder: BitVector) {

  /** Maps the supplied function over the decoded value. */
  def map[B](f: A => B): DecodeResult[B] = DecodeResult(f(value), remainder)

  /** Maps the supplied function over the remainder. */
  def mapRemainder(f: BitVector => BitVector): DecodeResult[A] = DecodeResult(value, f(remainder))
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy