Interface Codec.ResultFunction<A>

Type Parameters:
A - the type to encode and decode
Enclosing interface:
Codec<A>

public static interface Codec.ResultFunction<A>
An operator on the result a codec, describing how to transform the result on both encoding and decoding.
  • Method Details

    • apply

      <T> DataResult<Pair<A,T>> apply(DynamicOps<T> ops, T input, DataResult<Pair<A,T>> a)
      Transforms the result of decoding.
      Type Parameters:
      T - the type of the serialized form
      Parameters:
      ops - a DynamicOps for the serialized form
      input - the original data
      a - the result of the original decoding, holding a pair of the decoded data and the remaining serialized data
      Returns:
      a result holding a pair of the decoded data and the remaining serialized data
    • coApply

      <T> DataResult<T> coApply(DynamicOps<T> ops, A input, DataResult<T> t)
      Transforms the result of encoding.
      Type Parameters:
      T - the type of the serialized form
      Parameters:
      ops - a DynamicOps for the serialized form
      input - the original data
      t - the result of the original encoding, holding the serialized data
      Returns:
      a result holding serialized data