encodeTo method

  1. @override
void encodeTo(
  1. Result<R, E> value,
  2. Output output
)
override

Convert self to a slice and append it to the destination.

Implementation

@override
void encodeTo(Result<R, E> value, Output output) {
  if (value.isOk) {
    output.pushByte(0);
    okCodec.encodeTo(value.okValue as R, output);
  } else {
    output.pushByte(1);
    errCodec.encodeTo(value.errValue as E, output);
  }
}