Skip to content
  • Nathan Harris's avatar
    Refactor `RESPTranslator` to mutate the passed `ByteBuffer` directly. · b8c19488
    Nathan Harris authored
    Motivation:
    
    During proposal review, it was pointed out that the code with a position index was redundant and error prone over relying on `ByteBuffer`'s `readerIndex`.
    
    Modifications:
    
    Refactored `RESPTranslator` to rely on `ByteBuffer.readerIndex` for position of current parsing cursor,
    and eliminated `ParsingResult` enum to instead return `RESPValue?`.
    
    The implementation for writing out `RESPValue` has been expanded to `RESPValueConvertible` and moved to an extension of `ByteBuffer`.
    
    Result:
    
    Parsing `RESPValue` into and out of `ByteBuffer` should be less error-prone and more straight forward.
    
    This contributes to issues #47 and #55
    b8c19488