///|
pub impl Show for CodecError with fn output(self, logger) {
  match self {
    InvalidPayloadLength(bytes) =>
      logger <+ "invalid Steim frame payload length of \{bytes} bytes"
    InvalidSampleCount(n) =>
      logger <+
        "sample count \{n} exceeds the frame capacity or supported range"
    InvalidFrameBudget(n) => logger <+ "frame budget \{n} must be positive"
    InvalidFrameControl(frame) =>
      logger <+
        "control bits for the header words in frame \{frame} must be zero"
    ReservedSteim2Mode(frame, word, control, selector) =>
      logger <+
        "reserved Steim-2 control \{control} with selector \{selector} in frame \{frame}, word \{word}"
    TooFewDifferences(expected, found) =>
      logger <+ "expected \{expected} packed differences and found \{found}"
    ReverseConstantMismatch(expected, actual) =>
      logger <+
        "reverse integration constant Xn is \{expected} and the last decoded sample is \{actual}"
  }
}

///|
pub extend CodecError with Show::{to_string}